-
-
Couldn't load subscription status.
- Fork 393
Description
Description:
I'm having a issue with the following code:
app.Range(h.rows).Slice(func(i int) app.UI {
return &h.rows[i]
}),It works fine when the component is loaded for the first time, but not when the slice and range needs to be updated.
On rebuilding the underlying slice with data from API call, the UI behaves incorrectly.
I tried manually running component.Update - did not help.
The only work around is reloading the page with ctx.Reload() but it's doing an ugly page refresh, and it's not a solution really.
Steps to reproduce:
git clone [email protected]:rtrzebinski/simple-memorizer-4.git
git checkout 58475e1c1171863229ff0de07d7f9dbb4c2c8bd4
make dev
make run
open http://localhost:8000/exercises
Add exercises: (question / answer):
11 / 11
22 / 22
33 / 33
44 / 44
(in order to retry with a fresh database simply run make dev && make run again and refresh the page)
Expected result:
Exercises will appear on the list as they are added.
No manual page reload is needed to display them properly.
Actual result:
Only 11 / 11 (first one added) keeps being duplicated, regardless of the following inputs:
Where is the code?
Update trigger -> https://github.com/rtrzebinski/simple-memorizer-4/blob/58475e1c1171863229ff0de07d7f9dbb4c2c8bd4/internal/frontend/components/exercises.go#L71
Actual UI update -> https://github.com/rtrzebinski/simple-memorizer-4/blob/58475e1c1171863229ff0de07d7f9dbb4c2c8bd4/internal/frontend/components/exercises.go#L89
