acl-services / acl-services/paprika
Filter component not re-rendering
- 主要语言
- JavaScript
- 星标
- 54
- 派生
- 10
- 平均合并
- 1 天 12 小时
- 30 天内合并 PR
- 6
描述
In the Filter component I am trying to add an external button that if i click it, it applies another filter. Its not working as seen here (click the "Add Romario filter" button, notice how the filter count does not increase and there is no filter in the side panel): https://codesandbox.io/s/keen-rgb-7lmhg?file=/src/App.js
I got it to work by changing the `key` of the Filter's parent (click the "Add Romario filter" button, notice how the filter count DOES increase and there is a filter in the side panel): https://codesandbox.io/s/exciting-fast-ur8y8?file=/src/App.js but that unmounts and remounts the entire component unnecessarily.
Allison said:
```
I think this component should re-render as well
but the paprika filter component won’t recalculate the state
Do you think if it can be fixed by:
- the useFilter hook returns the dispatch function
- the defaultReducer adds a new case about updateState
- or we can just export a function called `updateState` from useFilter() , and don’t export the dispatch
```
贡献指南
这个仓库没有索引到贡献指南
调研方向
Reproduce the behavior in the linked `src/App.js` sandboxes and confirm the expected filter count and side panel updates. Then trace where the `Filter` component consumes `useFilter`/`defaultReducer` (or an `updateState` flow) and where the external button dispatches changes. Start by reading those hook/reducer files, then run the repo’s filter-related tests if available or the sandbox flow; done means the external button adds a filter and re-renders correctly without remounting via a changed parent `key`.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, react
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100