ui
ui copied to clipboard
CardDeck is not updated after edit action
tested on demos in RW mode (commented out transaction throw/break and no initPreventModification
):
- after edit: Card is not updated
- after delete: Card is not removed from the View
- after add: Card reloads (completely, and also quite slow with all ~250 countries CardDeck items on 1 page)
in RO mode (default):
- after add: no reload at all
- edit/delete testing is useless, until CardDeck updates correctly in RW mode, but then the same reload behaviour in RW/RO demos is expected
Dedup the reload code with Crud. Crud currently works as expected.
Regarding your comment on dedup CardDeck vs. Crud - I appreciate to see CardDeck just as another way of displaying a Crud, and having everything else the same. I made a quick overview of analogies, and also of parts that are missing in CardDeck implementation that are present though in Crud, not exhaustive, but a good starting point how a CardDeck derived from Crud could benefit from existing code.
@mvorisek Can we do a quick fix on this, as otherwise the CardDeck is in a way useless if it does not immediately reflect edits and deletes upon execution. The refactoring as a variant of Crud will take more time certainly to implement. Alternatively, @ibelar could you have a look how to make sure all APPLIES_TO_SINGLE_RECORD userAction updates are triggering a reload of the CardDeck after submit? And same with deletes?
For Single record actions, around this line https://github.com/atk4/ui/blob/6d98fafb8d21db20bb8461b306ca3f64e9123282/src/CardDeck.php#L159
also the initActionExecutor's logic has to be added to the Executor to reload if action was successful
@ibelar After some further look at the history commits, looks like this is broken since executor refactor by you done last year - any chance you can fix this easily? CardDeck is powerful and we should get it back running
@mkrecek234 I don't think Card reload or delete was ever implement, yet, in CardDeck. It was mainly for UserAction that does not modify model record.
@ibelar I did not dig deeply in it, but check this code out. Isn't this the reload feature (which actually works OK for added cards, but is not initialized for SINGLE_RECORD updates/deletes?
https://github.com/atk4/ui/blob/6d98fafb8d21db20bb8461b306ca3f64e9123282/src/CardDeck.php#L202
I'd think we have to somehow also make sure the we add a hook also after UserAction success/completed. Unfortunately, not experienced with the whole Executor logic as you are ;-) We have to make sure that $this->addClickAction also registers a hook after a completed UserAction to reload the CardDeck.