Skip to content
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

ui: Save some user preferences to browser's local storage #1968

Merged
merged 6 commits into from
Feb 7, 2025

Conversation

Etsija
Copy link
Contributor

@Etsija Etsija commented Feb 7, 2025

With this PR, user's choices for the page sizes of organizations, products, repositories and ORT runs data tables are seamlessly saved and persisted to browser's local storage, to improve the UX for ORT Server UI.

Please see the commits for details.

Zustand [1] is a hook-based, lightweight state management solution with
support for easy state persisting to for example browser's local storage.
It is probably the easiest solution for saving some user's UI preferences 
to the browser, to improve the UX.

[1]: https://zustand.docs.pmnd.rs/getting-started/introduction

Signed-off-by: Jyrki Keisala <[email protected]>
Create a Zustand store hook for saving and persisting the user's page 
size preferences for the organizations, products, repositories and ORT
runs data tables, with some sensible defaults.

Signed-off-by: Jyrki Keisala <[email protected]>
As an example for using Zustand to handle and persist user preferences
in the ORT Server UI, the organization data table's page size is handled
as follows:
- if the table preferences are not found from browser's local storage,
  default value for the page size of the table is used
- when the user changes the page size of the table the first time, 
  Zustand seamlessly persists the new chosen page size to browser's
  local storage
- all subsequent changes to organization table's page size are 
  persisted

Signed-off-by: Jyrki Keisala <[email protected]>
Copy link

github-actions bot commented Feb 7, 2025

Issues referenced in commit messages and issues linked to this PR are not in sync.
Please manually link this PR to the following issues: 1954

@Etsija Etsija linked an issue Feb 7, 2025 that may be closed by this pull request
@Etsija Etsija marked this pull request as ready for review February 7, 2025 08:54
@Etsija Etsija requested review from lamppu and mmurto as code owners February 7, 2025 08:54
@lamppu lamppu added this pull request to the merge queue Feb 7, 2025
Merged via the queue into main with commit 9dc6e28 Feb 7, 2025
52 checks passed
@lamppu lamppu deleted the save-user-preferences branch February 7, 2025 09:57
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.

Save some user preferences to browser
2 participants