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

Avoid using random DOM ids #1081

Open
mayel opened this issue Nov 21, 2024 · 1 comment
Open

Avoid using random DOM ids #1081

mayel opened this issue Nov 21, 2024 · 1 comment
Labels
Performance Work that improves the performance of bonfire

Comments

@mayel
Copy link
Member

mayel commented Nov 21, 2024

The random_dom_id/1 helper function (which generates a string like random-68436) is used quite a few places as a way to avoid errors like #1080, since both live components and DOM elements that have a LV JS hook need to have unique DOM IDs, but it probably messes with LV's change tracking / diffing, so better approaches are needed.

@mayel mayel added the Performance Work that improves the performance of bonfire label Nov 21, 2024
@mayel mayel added this to the 1.0 release candidates milestone Nov 21, 2024
@mayel
Copy link
Member Author

mayel commented Nov 21, 2024

So far we've tried things like id={"media_link-#{@showing_within}-#{id(@media) || random_dom_id()}-via-#{@parent_id}"} but it gets messy and sometimes breaks (like when the page layout changes and an element is shown in multiples places in some new way) and we end up with non-unique ones

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance Work that improves the performance of bonfire
Projects
None yet
Development

No branches or pull requests

1 participant