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

Playground: Fix errors not shown on page load #13262

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Sep 6, 2024

Summary

This PR fixes a bug in the playground where errors for a restored snipped didn't show on page load.

The core issue was that editor or editor.getModels was None when the diagnostics are updated, in which case the useEffect skips the diagnostics change.

This PR fixes the issue by:

  • Using onMount instead of beforeMount to only set the editor instance when the editor is fully loaded
  • Setting the diagnostics as part of the handleMount callback because the mount event could be triggered after are updated

I used this as a chance to only register a single code action provider.

Fixes #11918

Test Plan

Screencast.from.2024-09-06.10-00-24.webm

@MichaReiser MichaReiser added bug Something isn't working playground A playground-specific issue labels Sep 6, 2024
@MichaReiser MichaReiser merged commit 955dc88 into main Sep 9, 2024
20 checks passed
@MichaReiser MichaReiser deleted the micha/playground-show-errors-on-load branch September 9, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working playground A playground-specific issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Playground does not underline issues on first open until first code change
1 participant