Skip to content

Demos with window and without code do not show the previewer when JS is selected #812

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

Closed
theCapypara opened this issue Nov 16, 2023 · 2 comments · Fixed by #865 · May be fixed by #849
Closed

Demos with window and without code do not show the previewer when JS is selected #812

theCapypara opened this issue Nov 16, 2023 · 2 comments · Fixed by #865 · May be fixed by #849
Assignees

Comments

@theCapypara
Copy link
Contributor

theCapypara commented Nov 16, 2023

The previewer does not show if JavaScript is selected as the language and no code exists. It should instead show the "Show external previewer" button.

Additionally the "Run" button also does nothing in this case. I'm not sure if this is intentional, I think this is normal behaviour for external JS demos already.

Steps to reproduce

  1. Select "JavaScript" as the active language on any demo
  2. Select a demo without any code but with a Blueprint/XML file where the parent element is a Gtk.Window or subclass. Example: Navigation Split View
  3. The demo will open and the internal previewer pane is just empty and the "Run" button does not work.
  4. Switching to any other language will resolve this issue. In that case it can even be switched back to JavaScript and Workbench will behave as intended, except for possibly the "Run" button (see above).
@theCapypara theCapypara self-assigned this Nov 18, 2023
@theCapypara
Copy link
Contributor Author

Actually I was also able to reproduce this issue yesterday with a demo that has no window, so maybe it's not related to having/not having a window.

@sonnyp
Copy link
Contributor

sonnyp commented Nov 19, 2023

Additionally the "Run" button also does nothing in this case. I'm not sure if this is intentional, I think this is normal behaviour for external JS demos already.

It rerenders and reformats the code only in JS

sonnyp added a commit that referenced this issue Jan 14, 2024
sonnyp added a commit that referenced this issue Jan 14, 2024
sonnyp added a commit that referenced this issue Jan 14, 2024
Fixes #812
Closes #820

This is the culprit
https://github.com/workbenchdev/Workbench/blob/58b40d9802d14cbcc613a4f25489858783b808b2/src/window.js#L268-L272C6

For that particular code path (javascript selected, demo without js) it
wouldn't update the preview

One of the issue is that demos without code shouldn't have `autorun:
true`. I will fix that.
But in any case - I don't want Workbench to misbehave even if the demo
json is incorrect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants