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

Fix compatibility with Turbo Drive & Shoelace's autoloader #1338

Merged
merged 1 commit into from
May 17, 2023

Conversation

yuki24
Copy link
Contributor

@yuki24 yuki24 commented May 17, 2023

This PR updates the observer used to auto-load unleaded Shoelace components, so that this will be compatible with Turbo Drive.

I am sure that 99% of the time the existing autoloader implementation works fine, but Turbo Drive replaces the <body> tag upon page render, which in turn discards the observer. Because of this, Shoelace's autoloader stops working once a page transition occurs.

I know we don't have to monitor the <html> tags as well as <head> and <meta> tags, but hopefully this doesn't add any noticeable overhead... Let me know if there is anything I should change (e.g. testing).

@vercel
Copy link

vercel bot commented May 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
shoelace ✅ Ready (Inspect) Visit Preview May 17, 2023 0:45am

@yuki24 yuki24 changed the title Add better support for Turbo Drive & Shoelace's autoloader Fix compatibility with Turbo Drive & Shoelace's autoloader May 17, 2023
@claviska
Copy link
Member

Thanks for the PR. Moving the observer to <html> shouldn't create any problems.

@claviska claviska merged commit 22010a1 into shoelace-style:next May 17, 2023
1 check passed
@yuki24 yuki24 deleted the turbo-drive-support branch May 17, 2023 23:40
jeysonj2 pushed a commit to circular-o/circular that referenced this pull request May 23, 2023
jeysonj2 added a commit to circular-o/circular that referenced this pull request May 23, 2023
jeysonj2 added a commit to circular-o/circular that referenced this pull request May 23, 2023
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.

None yet

2 participants