Skip to content

Improve asynchronous loading and reloading #2

@PRGfx

Description

@PRGfx

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions