-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: store accordion preference #815
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…hub.com/ArdentHQ/arkvault into refactor/set-accordions-open-by-default
…store-accordion-preference
…store-accordion-preference
…com/ArdentHQ/arkvault into refactor/store-accordion-preference
…store-accordion-preference
…com/ArdentHQ/arkvault into refactor/store-accordion-preference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@patricio0312rev - is it possible to make this behaviour function independently of different profiles?
Currently, if you have 2 or more profiles setup, the accordian state is applied to all profiles. For example
- If I have 2 profiles (ProfileA and ProfileB)
- I open profile A
- I set Mainnet accordian to open. Devnet to closed
- This state should just be saved to profile A
- When I open profile B, it should open with the default view.
Currently whatever changes you make to profileA get applied to profileB too.
@samharperpittam should be fixed now 🌟 |
const storageKey = getStorageKey(key); | ||
const [isExpanded, setIsExpanded] = useState<boolean>(() => { | ||
const storedValue = localStorage.getItem(storageKey); | ||
return storedValue ? JSON.parse(storedValue) : true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I am parsing to keep the consistency of the booleans. If I remove this, we could get values like "true", "false" and that could lead to false positives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case storing 1 or 0 could resolve the issue 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although it simplifies the issue with "true" and "false", that would reduce readability, and seeing that there are a lot of components and hooks in the repo, I wouldn't take that path 🤔
[portfolio] store table state
Summary
use-accordion
hook has been refactored to store a key for each implementation in local storage. This refactor will allow to store the preference of the user regarding the accordion being opened or not on reload.Checklist