adamghill / django-unicorn

The magical reactive component framework for Django ✨
https://www.django-unicorn.com
MIT License
2.38k stars 119 forks source link

[Child Component State Issue] State not Updating #713

Open mhsiddiqui opened 3 months ago

mhsiddiqui commented 3 months ago

Bug Description

My scenario is that I have filters and the table below which will be updated based on filters.

There are following filters which I have

  1. Search
  2. Category
  3. Sub Category

On the category selection, I need to update the drop-down of subcategory. Filters are working fine but the subcategory dropdown is not updating. I checked by putting the child component out of the parent component, which works fine. But when I put that inside the parent component, It is not working.

Expected behaviour

The component state should be updated on changing category.

Screenshots / Screenrecords

https://github.com/user-attachments/assets/4691c10b-325a-455e-b73d-686a3918dc32

Steps to reproduce

No response

What browsers are you seeing the problem on?

No response

👀 Have you checked for similar open issues?

Code of Conduct

Are you willing to work on this issue ?

None

adamghill commented 3 months ago

It's hard to know what to do without looking at the actual code or a failing test case. Is there a small reproducible PR I can look at? Thanks!

fatihkurtl commented 3 months ago

I had a similar problem in a simple application I made, I solved the problem with the init() method, you can look here if you find it useful;

https://github.com/fatihkurtl/dj_unicorn/blob/main/uni_app/components/todo.py