Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions goosebit/ui/static/js/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ document.addEventListener("DOMContentLoaded", async () => {
stateSave: true,
select: true,
rowId: "id",
// Don't restore selection: Select matches row IDs as CSS selectors, and
// device IDs may contain invalid chars (e.g. ":") that abort table init.
stateLoadParams: (settings, data) => {
// biome-ignore lint/performance/noDelete: selection must not be restored
delete data.select;
},
Comment on lines +54 to +59

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this drop the user's selection when the table gets an update (every 3 seconds)? Any chance we can do something to handle those invalid characters (like URL encoding) rather than just deleting the selection?

ajax: {
url: "/ui/bff/devices",
method: "POST",
Expand Down Expand Up @@ -195,6 +201,11 @@ document.addEventListener("DOMContentLoaded", async () => {
})
.on("deselect", () => {
updateBtnState();
})
// Don't persist selection (see stateLoadParams above).
.on("stateSaveParams", (e, settings, data) => {
// biome-ignore lint/performance/noDelete: selection must not be persisted
delete data.select;
});

setInterval(() => {
Expand Down
11 changes: 11 additions & 0 deletions goosebit/ui/static/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ document.addEventListener("DOMContentLoaded", async () => {
stateSave: true,
select: true,
rowId: "username",
// Don't restore selection: Select matches row IDs as CSS selectors, and
// usernames may contain invalid chars (".", "@", ...) that abort table init.
stateLoadParams: (settings, data) => {
// biome-ignore lint/performance/noDelete: selection must not be restored
delete data.select;
},
Comment on lines +44 to +47

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same idea as above, although much less of an issue as I believe the user table doesn't get updated automatically.

ajax: {
url: "/ui/bff/settings/users",
data: (data) => {
Expand Down Expand Up @@ -125,6 +131,11 @@ document.addEventListener("DOMContentLoaded", async () => {
})
.on("deselect", () => {
updateBtnState();
})
// Don't persist selection (see stateLoadParams above).
.on("stateSaveParams", (e, settings, data) => {
// biome-ignore lint/performance/noDelete: selection must not be persisted
delete data.select;
});

setInterval(() => {
Expand Down
Loading