-
Notifications
You must be signed in to change notification settings - Fork 406
Move JS filters to Session storage #2016
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
Conversation
sago2k8
left a comment
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.
left couple of comments, It would be nice to implement a small test also.
| */ | ||
| function getAllFilters(): TopicFiltersMap { | ||
| try { | ||
| const stored = sessionStorage.getItem(SESSION_STORAGE_KEY); |
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.
Is sessionStorage a global variable ?
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.
It's a globally accessible object we can rely on
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.
could we validate the session storage works in secure environments, I assume it does. But I would like to double check
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.
what do you mean by secure env?
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.
I meant https, I think the browser might require and extra config. it's possible that the sessionStorage object handles this for you.
| import { uiState } from '../../../../../state/ui-state'; | ||
|
|
||
| export const MessageSearchFilterBar: FC<{ onEdit: (filter: FilterEntry) => void }> = observer(({ onEdit }) => { | ||
| const settings = uiState.topicSettings.searchParams; |
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.
I understand the change was to replace the global state by sessions storage, could we use zustand to manage this global state and use the persistence layer https://redpandadata.slack.com/archives/C063X3UEWCA/p1762753166216419
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.
I don't follow, what is the advantage of this? Session storage is persisted per reloads and only gets erased once user close the tab. Having zustand in between does't really make sense. UX doesn't want to have any kind of persistance here.
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.
Yes my point is if I want to use a global state that happens to be stored in Session Storage, so maybe if there is a known pattern of handling this global state it will be easier to maintain as opposed to a solution only for this page.
https://redpanda.zoom.us/clips/share/Qlro4VR9RWyzLJnb33pLaA