Skip to content

Fix blank preview on no code demos #865

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

Merged
merged 1 commit into from
Jan 14, 2024
Merged

Fix blank preview on no code demos #865

merged 1 commit into from
Jan 14, 2024

Conversation

sonnyp
Copy link
Contributor

@sonnyp sonnyp commented Jan 14, 2024

Fixes #812
Closes #820

@theCapypara thanks a lot for the bug report and PR
Took me a while to wrap my head around what was going on. 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.

This is a slightly different approach to what you suggested that instead separates load and run in a way that load is always called before run.

@sonnyp sonnyp requested a review from theCapypara January 14, 2024 00:27
Copy link
Contributor

@theCapypara theCapypara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh this is much better.
I was missing the insight into the inner workings of how it all works to properly do that, but I think separating them is exactly the way to go.

You may want to check if that cleanup I did for the console clearing is still necessary with this. When I did the original PR I noticed that compiler errors would immediately get cleared after refactoring, I'm not 100% sure this couldn't happen now as well, but I think it might.

@theCapypara
Copy link
Contributor

also the CI failure is strange 🤔

@sonnyp
Copy link
Contributor Author

sonnyp commented Jan 14, 2024

I noticed that compiler errors would immediately get cleared after refactoring

I'm not following - but we can chat about it for clarification. I'll merge and we can address this separately if needed.

@sonnyp sonnyp merged commit 700c327 into main Jan 14, 2024
@sonnyp sonnyp deleted the fix-812 branch January 14, 2024 12:09
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

Successfully merging this pull request may close these issues.

Demos with window and without code do not show the previewer when JS is selected
2 participants