Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Save filters and sorters to profile #10

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Save filters and sorters to profile #10

wants to merge 1 commit into from

Conversation

SavageCore
Copy link
Owner

Closes #3

@SavageCore SavageCore self-assigned this Jul 19, 2024
@SavageCore
Copy link
Owner Author

There appears to be an upstream bug related to sortedInfo so waiting for conclusion of that before merging this

I wrote on discord:

Found a bug with sortedInfo

Change the sort order of any item, reload the page and the sort is not re-applied. See attached log, seems invalid JSON is saved.

Looks to me like it is doubled parsed?

try {
  const storedSortedInfo = JSON.parse(localStorage.getItem('sortedInfo'));
  if (storedSortedInfo) {
    setSortedInfo(JSON.parse(storedSortedInfo));
  }
} catch (error) {
  // Handle the error
  console.error('Error parsing stored sortedInfo:', error);
  // Remove the key from localStorage
  localStorage.removeItem('sortedInfo');
}

Comparing to

const storedFilteredInfo = localStorage.getItem('filteredInfo');

if (storedFilteredInfo) {
  setFilteredInfo(JSON.parse(storedFilteredInfo));
}

https://discord.com/channels/1220524110090600599/1220524223068635156/1263653657472143452

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Profiles should save current pagination, filters and sorting
1 participant