Skip to content

fix(file_server): persist browse layout setting using localStorage#7604

Open
xingzihai wants to merge 1 commit intocaddyserver:masterfrom
xingzihai:fix/issue-6386-browse-layout-persist
Open

fix(file_server): persist browse layout setting using localStorage#7604
xingzihai wants to merge 1 commit intocaddyserver:masterfrom
xingzihai:fix/issue-6386-browse-layout-persist

Conversation

@xingzihai
Copy link
Copy Markdown

This PR fixes the issue where the file_server browse layout setting was not persisted.

Fixes #6386

Changes:

  • The browse layout setting is now saved using localStorage
  • Users will no longer lose their preferred layout setting when navigating between pages

Testing:
Test by changing the layout in file_server browse, then navigating to a different directory and back. The layout setting should persist.

Issue caddyserver#6386: Layout setting (list/grid) was not saved and reset on page refresh.

Root cause: Layout preference was only stored in URL query parameter.
When navigating to a new path or refreshing without the parameter,
layout would reset to default (list).

Solution: Persist layout choice using localStorage:
- Save layout to localStorage when user clicks layout buttons
- On page load, check localStorage and update URL if needed

This ensures layout preference persists across:
- Page refreshes
- Navigation to different directories
- New browser sessions
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@francislavoie
Copy link
Copy Markdown
Member

Missing the AI disclosure section (part of the PR template), and CLA needs to be signed.

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.

[file_server browse] Layout setting is not saved

3 participants