Missing navigation history/back functionality
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 28/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- react, typescript
- 领域
- frontend
调研方向
未指定文件或测试。首先查看 wouter 现有的 router 和导航入口,然后将其与提议的 useHistory 和 navigateBack API 进行比较。当项目范围已确定,并且已记录前一路由导航、回退处理和历史状态管理的行为时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Problem
Currently, wouter doesn't provide a built-in way to navigate back to the previous page or access navigation history. This forces developers to implement workarounds like:
- Using
window.history.back()directly (which may cause page reloads) - Implementing custom state management with sessionStorage/localStorage
- Creating complex navigation state tracking systems
Use Case
In a typical SPA, users expect the back button to work intuitively:
- From a product page back to the store page
- From an order details page back to the orders list
- From any nested page back to its parent
Proposed Solution
It would be great if wouter could provide:
- A
useHistoryhook that gives access to navigation history - A
navigateBack()function that safely goes to the previous route - History state management that works seamlessly with the router
Current Workaround
const handleBack = useCallback(() => {
if (window.history.length > 1) {
window.history.back();
} else {
navigate('/fallback-route');
}
}, [navigate]);
Questions
- Is there a recommended way to handle back navigation in wouter?
- Are there plans to add history management features?
- Should we consider using a different router that has this functionality built-in?
This would significantly improve the developer experience and make wouter more competitive with other routing solutions.
- 主要语言
- TypeScript
- 星标
- 7.9k
- 派生
- 193
- 平均合并
- 9 分钟
- 30 天内合并 PR
- 1
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
molefrog/wouter 的其他 Issue
-
Wouter double-decodes search params in `useSearchParams`, which can lead to �可能已有人在做 @priyas1672 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 3/5 1-2 天 新手友好度 52/100
-
难度 4/5 3-5 天 新手友好度 45/100
-
难度 3/5 1-2 天 新手友好度 45/100
-
Links using ~ do not respect `base`可能已有人在做 @molefrog 于 27 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 45/100
相似的 Issue
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1 小时以内 新手友好度 61/100
lingdojo/kana-dojo#33465 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
opensheetmusicdisplay/opensheetmusicdisplay#1885 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
Time zone picker still shows America/Winnipeg as -06:00 after Manitoba’s move to permanent UTC-5未关闭
难度 2/5 1-3 小时 新手友好度 66/100
home-assistant/frontend#55537 ·
维护者通常 1 天内回复
-
needs-triage
难度 1/5 1 小时以内 新手友好度 82/100
manaflow-ai/cmux#31347 ·
维护者通常 1 天内回复