Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Props from Navigation disappear at page refresh/reload

未关闭
#4,332 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
javascript, react
领域
frontend

调研方向

从一个使用 browserHistory 和 f7.views.main.router.navigate("/somePage/", {props: {id: 123}}); 的最小 Framework7 React 应用开始;在浏览器重新加载前后,通过 React DevTools 或 useEffect 检查 props。完成标准是确定导航 props 是否可以在重新加载后保持,同时不破坏直接 URL 导航;如果项目提供复现测试,则添加或更新该测试。

由索引模型根据 Issue 内容生成。

描述

  • Framework7 version: ^8.3.4
  • React.js version: ^18.3.1
  • Platform and Target: Desktop App
  • Live Link or CodeSandbox: Can not be replicated in Sandbox due to different behaviour when reloading the page
Describe the bug

When navigating to a route and passing props with the options
f7.views.main.router.navigate("/somePage/", {props: {id: 123}})
the props object correctly contains id. But when reloading the page (via Browser) it disappears.

Additional Information:

  • I am using browserHistory as defined in the View Component. Otherwise the reload wouldn't even work as intended.
  • f7router and f7route stay in the props object even after reloading
To Reproduce

Just build a simple app, try navigation with props and then reload the page. Control the contained props with React DevTools, or just log them to the console with a useEffect.

Expected behavior

The set property from navigation should stay when reloading the page.

Actual Behavior

It does not persist.

Additional context

My guess would be that this behaviour might be somewhat intended, since navigating directly to the page (via URL) does not provide any properties and distinguishing between that and a page reload could be difficult. But i think this should still work.
I will probably work around this by storing the passed property in a global store that provides it's own persistence, but i still f7 should be able to handle this.

主要语言
JavaScript
星标
18.8k
派生
3.2k
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

framework7io/framework7 的其他 Issue

查看 framework7io/framework7 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。