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

Enhancement: Retry frontend highlighter init later #829

Merged

Conversation

pattonwebz
Copy link
Member

This PR adds a simple retry later to init the Frontend Highlighter. This should solve the issue where Cloudflare Rocket Loader defer prevents the highlighter from initialising.

It will try init first on DOMContentLoaded and then later at load. It adds a variable as a flag to track if the init code has already run to prevent it duplicating on load if it already ran when initially intended.

Checklist

  • PR is linked to the main issue in the repo
  • Tests are added that cover changes

src/frontendHighlighterApp/index.js Outdated Show resolved Hide resolved
Copy link
Member

@SteveJonesDev SteveJonesDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor improvement could be to change initHasRun to highlighterInitialized so it's more descriptive. Either way is fine, I'll let you decide.

@pattonwebz pattonwebz merged commit 7fbbb0e into develop Dec 19, 2024
16 checks passed
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.

2 participants