The selected category is not persisted across page loads
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- javascript
- 领域
- frontend
调研方向
从 getFilteredNotes() 附近的笔记视图、/app/notes 入口点以及现有的 loadRecentOnStartup 和 notesLastViewNote 行为开始。跟踪选定类别和当前 URL 的处理方式,然后与维护者一起解决有关查询状态编码、启动时恢复和 URL 同步的未决问题。完成的标准是:刷新、共享链接、浏览器前进/后退导航以及应用全新启动都能保留预期类别,且不会混淆 All Notes 和 Uncategorized。
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem? Please describe.
When a user selects a category, it is only maintained in-memory. It isn't stored in the URL and isn't persisted anywhere else. The symptom is that the category resets to "All notes" on every page load and when the app is loaded fresh.
However, the filtering works. getFilteredNotes() does filter by the category the user selects and changes the sorting from "most recent" to the selected category. But any refresh changes the view back to "most recent" in the notes list and doesn't retain the selected category. For users who work in a particular category, it means continually clicking back to that category.
Also, browers back/forward navigation doesn't navigate between categories.
Describe the solution you'd like
There are two parts to the feature and each could land independently:
- Store the selected category in the URL so the category remains selected when the page reloads or the user uses the back/forward navigation in their browser or shares a link
- Use a user setting to restore the category the user selected last when the app loads. This would be similar to how the last-viewed note is loaded using
loadRecentOnStartupandnotesLastViewNote. Part 1 by itself doesn't cover what is likely the common use case of opening Notes from the app menu. It lands on/app/noteswith no query string so the user has to navigate back to the category they had navigated to last time they were in the app.
Describe alternatives you've considered
For the first item, I considered a path segment (/category/:category/) but the categories are stored as folder paths containing the forward slash. This would make the wildcard route ambiguous vis-a-vis the existing /note/:noteId. It would also break existing note URLs. Using a query param avoids these problems while encoding the slashes properly and matching the current ?new convention.
For the second item, I considered browser storage as a simpler option but the app doesn't currently use that. So we went with the approach that notesLastViewedNote already uses. Also, this approach allows for syncing across devices.
Additional context
Issue #1079 talks about persisting the visibility of the navigation itself. While this is a different setting, it does address the same underlying gap as this request. #879 which is about the category tree (something else I'm very keen on addressing) would also need persistence so creating the foundation here would be beneficial to other features that would need the same persistence mechanism.
Here are some open questions:
- Should I use the query parameter as I suggest or the path segment for the category in the URL?
- How should the URL represent "Uncategorized" (which is an empty string and a real category) from "All Notes" which is a null category. Right now, these are distinct states and naive encoding wouldn't distinguish between them.
- Should restoring the category on startup be a new setting or should it be folded into the existing
loadRecentOnStartupsetting? - If item 2 restores the category on startup, should this be reflected in the URL as well so the URL has the actual category state? I think this is a good design choice but want to confirm first.
Investigated with the help of Claude Code.
- 主要语言
- JavaScript
- 星标
- 738
- 派生
- 162
- 平均合并
- 2 小时 40 分钟
- 30 天内合并 PR
- 39
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nextcloud/notes 的其他 Issue
-
bug need to reproduce
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
bug need to reproduce
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
feature request needs discussion
难度 1/5 1 小时以内 新手友好度 62/100
nextcloud/notes#1344 · 1 条评论 ·
维护者通常 1 天内回复
-
feature request needs discussion
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
Complexity: Small P-Feature: Projects page ready for merge team role: back end/devOps role: front end size: 0.25pt
难度 1/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 67/100
bellingcat/toolkit#905 ·
-
self-care self-care:docs-build-time-investigator
难度 2/5 半天 新手友好度 76/100
githubnext/gh-aw-cao#14191 ·
维护者通常 1 天内回复
-
effort:low impact:medium RAG status: auto-triaged
难度 2/5 1-3 小时 新手友好度 84/100
mastra-ai/mastra#25229 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
sugarlabs/musicblocks#8984 ·
维护者通常 1 天内回复