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

Clarify <turbo-stream> Processing in Docs #216

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

marcelokanzaki
Copy link

Current wording about “stream elements connected to the page dom” felt a bit vague, so this update tries to make it clearer. Open to any suggestions if it can be improved further!

Current wording about “stream elements connected to the page dom” felt a bit vague, so this update tries to make it clearer. Open to any suggestions if it can be improved further!
@radanskoric
Copy link
Contributor

Thanks for trying to clarify this. I wrote that sentence and I struggled a bit to get the right wording without losing precision. "Connected" is picked deliberately because this is how it's called in the browser lifecycle of custom elements: https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks

The nuance is that it can be added to the page in any way possible and it will execute: for example you can construct it with javascript and you can also insert it using a turbo stream action (yes, action in an action). So "connected to the page dom" is the most technically accurate description.

However, I agree it's confusing if you're not familiar with that. And, the two use cases you mention are going to be by far the most common uses.

Maybe a slightly different wording might still be equally readable while being more accurate:

Also, any `<turbo-stream>` element that's inserted into the page (e.g. through full page or frame load), will be processed ...

Wdyt?

@marcelokanzaki
Copy link
Author

Hey @radanskoric I agree. I've updated the PR. Thank you for the explanation.

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

Successfully merging this pull request may close these issues.

2 participants