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

Make dev overlay lazy #1641

Closed
wants to merge 1 commit into from
Closed

Conversation

brenelz
Copy link
Contributor

@brenelz brenelz commented Sep 29, 2024

PR Checklist

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • infrastructure changes
  • Other... Please describe:

What is the current behavior?

The current behavior is that the syntax highligher always loads with the pages even when there is no error

image

What is the new behavior?

The new behavior makes the dev overlay lazy so it only loads the syntax highlighting when their is an actual error.

I may be misunderstanding something, and this won't work but seems like it would.

image

Copy link

changeset-bot bot commented Sep 29, 2024

⚠️ No Changeset found

Latest commit: da9ed21

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@lxsmnsyc
Copy link
Member

clientOnly is already lazy. The reason we need clientOnly is because part of the component loads libraries that are meant to be on the client-side.

@brenelz
Copy link
Contributor Author

brenelz commented Sep 29, 2024

Yeah maybe I don't understand clientOnly vs lazy. I just noticed it loads the shiki library even when the overlay isn't present in dev mode. I'd think it would only load that javascript if the <DevOverlay /> is shown?

@ryansolid
Copy link
Member

It isn't actually lazy.. we preload clientOnly even if it isn't rendered yet. So the desire here is legit. I think we need to both. Maybe a prop. Let me think of something.

@lxsmnsyc
Copy link
Member

@ryansolid yeah I just realized. We could probably rework clientOnly to be lazy by default, there isn't exactly a pro and con for it not being lazy right?

@ryansolid
Copy link
Member

I did preload intentionally so that it would load slightly faster even if not rendered right away. I was coming from the perspective that you wanted the code to only run in the client not to be lazy. It is easy to add it as an options argument. I think I will just do that.

@ryansolid
Copy link
Member

I fixed it a different way by adding lazy option to clientOnly.

@ryansolid ryansolid closed this Oct 18, 2024
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.

3 participants