HelloGitHub-Team / geese

采用 Next.js 构建的开源爱好者社区。An open-source enthusiast community built with Next.js.
https://hellogithub.com
Apache License 2.0
282 stars 66 forks source link

[优化]首页改版 #94

Closed 521xueweihan closed 1 year ago

521xueweihan commented 1 year ago

HelloGitHub 社区首页正在动工改版!将围绕 更方便、增强互动、独特性 的方向进行优化,诚邀您体验后进行反馈。地址:https://hellogithub.com/

目前的改动计划:

如果您有什么建议,欢迎留言讨论。

github-actions[bot] commented 1 year ago

Branch i94-_优化_首页改版 created!

WShihan commented 1 year ago

点击进入项目介绍页面后返回,首页自动刷新到头部,能否考虑进入介绍页面时缓存首页内容。

aolyang commented 1 year ago

猜测是不是需要一个缓存location的内容?

const location = useLocation()
const state = location.state as { backgroundLocation?: Location }

<Routes location={state?.backgroundLocation || location}>
    ...
    <Route path={"/repo-details"} element={<RepoDetails />} />
</Routes>

// 返回列表,其实任何页面进入了详情,都是缓存的
navigate(-1)
// 导航去别的页面
navigate("others")

https://dev.to/devmdmamun/create-contextual-modal-navigation-with-react-router-v6-28k2

zhangzhonghe commented 1 year ago

点击进入项目介绍页面后返回,首页自动刷新到头部,能否考虑进入介绍页面时缓存首页内容。

@WShihan 现在的项目介绍页是在新的页面中打开的,如果要返回上一个页面建议直接把当前页面关闭就可以了。

521xueweihan commented 1 year ago

@WShihan done