acl-services / acl-services/paprika

Filter component not re-rendering

Open
#1,170 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
54
Forks
10
Avg merge
1d 12h
Merged PRs (30d)
6

Description

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
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.