Skip to content

#4013 fix all change request table crash#4103

Open
patriots1 wants to merge 16 commits intodevelopfrom
#4013-Fix-All-Change-Request-Table-Crash
Open

#4013 fix all change request table crash#4103
patriots1 wants to merge 16 commits intodevelopfrom
#4013-Fix-All-Change-Request-Table-Crash

Conversation

@patriots1
Copy link
Copy Markdown
Contributor

Changes

When an item is removed from localStorage and it becomes undefined, we still access it using localStorage.setIterm. This is the main cause of the issues. I fixed this via adding a condition to check against undefined and added a try and catch statement to JSON.parse to catch any corrupted values in localStorage.

Test Cases

  • Add a condition for filtering
  • Press X twice to delete condition
  • Navigate to "Others" tab
  • Navigate back - All Changes table doesn't crash.

Closes #4013

@patriots1 patriots1 self-assigned this Mar 31, 2026
Copy link
Copy Markdown
Contributor

@Steph375 Steph375 left a comment

Choose a reason for hiding this comment

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

This looks good to me just one small change! Great job!

filterValues = JSON.parse(localStorage.getItem('changeRequestsTableFilter') ?? defaultFilter);
} catch {
localStorage.removeItem('changeRequestsTableFilter');
filterValues = JSON.parse(defaultFilter);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One edge case: if localStorage contains valid JSON but not the expected shape, this will still succeed and give us undefined values in initialState. Might be worth validating the parsed object before using it.

@patriots1
Copy link
Copy Markdown
Contributor Author

Added checks to enforce valid JSON structure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Maintenance] - All Change Requests table crash

5 participants