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

Cruds in multiple-layered modals behave strange #1732

Closed
mkrecek234 opened this issue Feb 7, 2022 · 8 comments · Fixed by #1765
Closed

Cruds in multiple-layered modals behave strange #1732

mkrecek234 opened this issue Feb 7, 2022 · 8 comments · Fixed by #1765
Assignees

Comments

@mkrecek234
Copy link
Contributor

mkrecek234 commented Feb 7, 2022

  • Have a master Crud, and add Modal to open a child model crud. (1)
  • You open the Child Model Crud in a Modal -there you add entries
  • Works fine.
  • Then select another master crud's entry (2) where you open the respective child Crud in the modal
  • If you then click add, you see the previous, already filled-in form (1's child entry)
  • If you close the modal manually, you see an empty (correct) add form - if you enter new entries there, it won't close the modal, but it still saves its content. If you manually close it you see the correct Crud entry.

Seems a logic error on cascaded cruds/modals.
See video here:

Bildschirmaufnahme.2022-02-07.um.21.40.59.mov
@mvorisek

This comment was marked as resolved.

@mvorisek
Copy link
Member

mvorisek commented Feb 8, 2022

linking here another Modal related issue - #1699

@mkrecek234

This comment was marked as resolved.

@mkrecek234
Copy link
Contributor Author

@ibelar Any idea how to fix this critical and major bug? Really limiting factor to make use of modals unfortunately.

Seems also that loading a Virtual Page as Modal from another Modal shows exactly the same issue as above - so not necessarily linked to Crud only, but loading a Modal from a Modal (and closing it, reopening another dynamically loaded Modal).

@mvorisek
Copy link
Member

mvorisek commented Apr 7, 2022

loading a Virtual Page as Modal from another Modal shows exactly the same issue as above

that should be simpler to debug, please post a minimalistic code and exact steps to reproduce

@mkrecek234
Copy link
Contributor Author

mkrecek234 commented Apr 8, 2022

Hard to reproduce, in some instanced I could make it happen that also a modal was empty. In sample code of PR #1764 one of the modals causes a memory leakage.
Anyone an idea? The above video of myself was coded a bit differently: I defined custom Crud classes, and inside CustomCrud->setModel() I typically added then the VirtualPages. This causes the effect in my first video "doubling" the modals after some time, or showing old ones which should have been closed.

Here is the memory leakage video - you can also see I have to close the non-loading modal twice to go back which resembles the error in my first video. - #1764 (comment)

@mkrecek234
Copy link
Contributor Author

mkrecek234 commented Apr 8, 2022

Highly strange - If I add another static modal inside the addModalAction right after $modalvp3 = ... using $inactivemodal = \Atk4\Ui\Modal::addTo($v);, the memory leakage disappears.

And the doubling of the modals, happens after I have opened twice the modals and closed with different records. If I then open the second lay modal a third time, the HTML code shows that two new modals are added when opening it, instead of one:

image

@mvorisek
Copy link
Member

mvorisek commented Apr 8, 2022

I confirm the initial submited issue and simplified the repro code to https://github.com/atk4/ui/blob/3fd832f729ad230dd918958c9fac09181266095f/demos/_unit-test/crud_gh1732.php using already present demo models

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants