Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[filter-panel] React wrapper: Expose component state as something easily consumable by React #7796

Closed
2 tasks done
bdsqqq opened this issue Dec 1, 2021 · 5 comments
Closed
2 tasks done
Assignees
Labels
adopter support bug Something isn't working dev Needs some dev work inactive severity 4 Affects minor functionality, no workaround needed

Comments

@bdsqqq
Copy link

bdsqqq commented Dec 1, 2021

The problem

I find it hard to use this component because it needs me to handle the synchronization between the component's internal state and react state. It is quite simple when the filter panel is the only thing that mutates a particular state but making the filter panel react to other components mutating state gets complicated fast and has a lot of imperative code attached to it.

The solution

I would like if the component exposed a consumable piece of state that updates the filter panel when mutated.

Application/website

https://www.ibm.com/events/

Business priority

Low Priority = release date is not dependent on fix or not upcoming

What time frame would this ideally be needed by (if applicable)

No response

Examples

This sandbox shows an implementation I made with the current component. It shows how the component interacts with state that is changed by other components.
One curious edge case I found happens when you:

  1. Select a filter by clicking one of the checkboxes
  2. Use the button "remove [filterName]" to remove the selection

The filterPanel component will react to the change due to a useEffect, but only the total number of selected filters will be updated, the filter that you just removed from selection will continue with a check.
Similarly, if you selected a filter by using the text input (for example, typing "On demand" and pressing enter) the filter panel would react, the total number of selected filters would update, but the checkbox would continue empty.
This could be solved by including the an method to update the checkboxes in a useEffect but I think this behavior should be included out of the box.

Code of Conduct

@RobertaJHahn
Copy link

@IgnacioBecerra Would to work around be to use the Web Components version directly?

@IgnacioBecerra
Copy link
Contributor

@bdsqqq It's possible that using the Web Components version directly might help, but we might have to investigate further.

cc: @RobertaJHahn

@jeffchew jeffchew added bug Something isn't working severity 4 Affects minor functionality, no workaround needed and removed Feature request A new adopter requested feature follow-up: DDS engineering labels Jan 4, 2022
@stale
Copy link

stale bot commented Apr 19, 2022

We've marked this issue as stale because there hasn't been any activity for 60 days. If there's no further activity on this issue in the next three days then we'll close it. You can keep the conversation going with just a short comment. Thanks for your contributions.

@stale stale bot added the inactive label Apr 19, 2022
@jhossain1
Copy link

!stale

@stale stale bot removed the inactive label Apr 19, 2022
@stale
Copy link

stale bot commented May 28, 2023

We've marked this issue as stale because there hasn't been any activity for 60 days. If there's no further activity on this issue in the next three days then we'll close it. You can keep the conversation going with just a short comment. Thanks for your contributions.

@stale stale bot added the inactive label May 28, 2023
@andy-blum andy-blum closed this as not planned Won't fix, can't repro, duplicate, stale Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adopter support bug Something isn't working dev Needs some dev work inactive severity 4 Affects minor functionality, no workaround needed
Projects
Status: Done
Development

No branches or pull requests