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

Not properly showing with dynamic previewing #12

Open
jacob-g opened this issue Jan 19, 2022 · 1 comment
Open

Not properly showing with dynamic previewing #12

jacob-g opened this issue Jan 19, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@jacob-g
Copy link
Member

jacob-g commented Jan 19, 2022

Steps to reproduce:

  1. Go to settings -> editing and enable "Show previews without reloading the page"
  2. Edit a page with scratchblocks
  3. Hit "Show Preview"
  4. Change the content blocks
  5. Hit "Show Preview" a second time
  6. Notice that the blocks did not render

Solution:

Trigger a render when live previews are generated. A hacky solution would be to just add an event listener to the "Show Preview" button, but a better solution would be to see if there are any JS events fired or something. MW documentation seems to indicate there is a "wikipage.content" hook we can use.

Example code from MW for the hook is:

mw.hook( 'wikipage.content' ).add( fn ).remove( fn );
@jacob-g jacob-g added the bug Something isn't working label Jan 19, 2022
@jacob-g
Copy link
Member Author

jacob-g commented Jan 19, 2022

It appears we do properly use the hook and the function is running. Adding a delay (via setTimeout) seems to make it load properly, so maybe we're somehow triggering too early?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Bug - Reproduced
Development

No branches or pull requests

1 participant