acdlite / acdlite/redux-router

ReduxRouter does not remove hashchange-listener on unmount

未关闭
#132 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
JavaScript
星标
2.3k
派生
194
PR 合并指标
30 天内没有已合并 PR

描述

When unmounting an React-app with ReactDOM.unmountComponentAtNode() the hashchange-listener of createHistory is not removed. It is added by the history.listen call in client.js, but the returned unlisten-function is not stored and never called.
Somehow the unlisten function needs to get called in ReduxRouter.componentWillUnmount().

As a quickfix, I added the unlisten-function to the returned store of historySynchronization() and called it from ReduxRouter.componentWillUnmount, but I guess thats not the best way to do it...

Thx for your help!

贡献指南

这个仓库没有索引到贡献指南

调研方向

The issue is in client.js where history.listen is called, but the returned unlisten function is not stored. Examine ReduxRouter.componentWillUnmount to see where to call it. Look at the historySynchronization function to understand how the store and history are connected. A fix involves storing the unlisten function and ensuring it's called on unmount.

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

评估

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

把新 issue 发到你的邮箱

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