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

Morph Refresh Breaks Web Component Styles #552

Open
modagavr opened this issue Jan 8, 2024 · 3 comments
Open

Morph Refresh Breaks Web Component Styles #552

modagavr opened this issue Jan 8, 2024 · 3 comments

Comments

@modagavr
Copy link

modagavr commented Jan 8, 2024

Using morph refresh method (turbo 8 beta + turbo-rails 2 beta)

Using shoelace web components library

turbo_stream_from @conversation
with broadcasts_refreshes in Conversation model

buttons and other web component elements become ugly
image

how it should look like and how it properly works with current latest stable packages (turbo 7 + turbo-rails 1.5)
image

@modagavr
Copy link
Author

modagavr commented Jan 8, 2024

Maybe idiomorph doesn't work well with Shadow DOM or something like that

@kotogavr
Copy link

kotogavr commented Jan 8, 2024

+1
I have the same problem with the same setup.

@KonnorRogers
Copy link

Hi there! Shoelace maintainer here 👋. The problem exists because morphing libraries never re-run the constructor function of the web component so it ends up not having the expected default properties.

there's a pretty lengthy discussion here:

stimulusreflex/stimulus_reflex#511 (comment)

the TLDR is that you need to provide all default attributes for the component up front in your server rendered HTML for it to work out of the box as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants