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

Call initial setupDeclarativeReflexes() on document.readyState === 'complete' #602

Merged
merged 3 commits into from Aug 21, 2022

Conversation

marcoroth
Copy link
Member

@marcoroth marcoroth commented Aug 20, 2022

Type of PR

Bug Fix

Description

This improves the reliability when using Importmaps, so that we can be sure that the DOM is setup properly, so the setupDeclarativeReflexes() function can be called in the right order.

Additionally we export the setupDeclarativeReflexes() so users can call this function manually if needed, i.e. if they have a specific load order/setup.

Why should this be added

Improves the reliability when using StimulusReflex with Importmaps.

Thanks to @matheau for reporting this and providing their work-around.

Checklist

  • My code follows the style guidelines of this project
  • Checks (StandardRB & Prettier-Standard) are passing
  • This is not a documentation update

@marcoroth marcoroth changed the title Also setupDeclarativeReflexes() on document.readystatechange Call initial setupDeclarativeReflexes() on document.readyState === 'complete' Aug 21, 2022
@marcoroth marcoroth merged commit 6d892bd into master Aug 21, 2022
@marcoroth marcoroth deleted the importmaps-readystatechange branch August 21, 2022 22:49
@leastbad
Copy link
Contributor

Thank you for following up with good research!

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