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

Improve asynchronous loading and reloading #2

Open
PRGfx opened this issue Nov 21, 2023 · 0 comments
Open

Improve asynchronous loading and reloading #2

PRGfx opened this issue Nov 21, 2023 · 0 comments

Comments

@PRGfx
Copy link
Owner

PRGfx commented Nov 21, 2023

An easy way to display content from the backend is to query the iframe content and fetch data-attributes:

bodyTag.attributes.data-example = ${...}
  # ...
    content: ClientEval:document.querySelector('iframe').contentDocument.body.dataset.example

Depending on the view, this data may not be available when the inspector is loaded.
This can be counteracted with a resolving a promise (e.g. ClientEval:new Promise(r=>setTimeout(()=>r(…), 1000) or something more elaborate waiting for elements), however this is not very nice.
(You can of course inject additional scripts into the site through the Neos.Neos.Ui.resources.javascript settings and expose helpers to your ClientEval)

Additionally, the data in the view is only reloaded when it is created. You can trigger this by collapsing and re-opening the inspector group, but that isn't UX.

Some ideas might be:

  • showLoader option which will trigger a loader once the content is found to be an asynchronous loader and the content is not yet available
  • reloadTriggers option which might be a string array of available events, e.g. contentLoaded, nodeCreated, nodeModified, nodeRemoved, nodeSelected etc.
  • An option similar to react hook dependencies to determine this re-rendering, i.e. create some kind of "cache"-discriminator
  • Additional helpers added to the ClientEval context e.g. the guest-frame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant