ui icon indicating copy to clipboard operation
ui copied to clipboard

CardDeck is not updated after edit action

Open mvorisek opened this issue 2 years ago • 1 comments

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.

mvorisek avatar Aug 31 '22 21:08 mvorisek

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.

CrudVsCardDeck.xlsx

mkrecek234 avatar Sep 01 '22 18:09 mkrecek234

@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?

mkrecek234 avatar Oct 20 '22 04:10 mkrecek234

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

mkrecek234 avatar Oct 20 '22 07:10 mkrecek234

@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 avatar Oct 20 '22 07:10 mkrecek234

@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 avatar Oct 20 '22 14:10 ibelar

@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.

mkrecek234 avatar Oct 20 '22 15:10 mkrecek234