Skip to content

Conversation

@jvorcak
Copy link
Collaborator

@jvorcak jvorcak commented Nov 5, 2025

@jvorcak jvorcak marked this pull request as draft November 8, 2025 08:03
@jvorcak jvorcak changed the title Move JS filters to URL Move JS filters to Session storage Nov 11, 2025
@jvorcak jvorcak marked this pull request as ready for review November 11, 2025 09:49
Copy link
Contributor

@sago2k8 sago2k8 left a 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);
Copy link
Contributor

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 ?

Copy link
Collaborator Author

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

Copy link
Contributor

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

Copy link
Collaborator Author

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?

Copy link
Contributor

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;
Copy link
Contributor

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

Copy link
Collaborator Author

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.

Copy link
Contributor

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.

@jvorcak jvorcak merged commit 9d4a84c into master Nov 11, 2025
7 checks passed
@jvorcak jvorcak deleted the feature/move-js-filters-to-URL branch November 11, 2025 18:16
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.

4 participants