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

Don't wait for DOM ready #476

Closed
wants to merge 1 commit into from
Closed

Don't wait for DOM ready #476

wants to merge 1 commit into from

Conversation

humitos
Copy link
Member

@humitos humitos commented Dec 18, 2024

I understand we don't need for the DOM to be ready to start performing the API requests and initializing our addons.

This PR should improve the load speed a little since it performs the API requests as soon as possible.

I understand we don't need for the DOM to be ready to start performing the API
requests and initializing our addons.

This PR should improve the load speed a little since it performs the API
requests as soon as possible.
@humitos humitos requested a review from a team as a code owner December 18, 2024 16:16
@humitos humitos requested a review from agjohnson December 18, 2024 16:16

return getReadTheDocsConfig(sendUrlParam);
})
getReadTheDocsConfig(sendUrlParam)
Copy link
Contributor

Choose a reason for hiding this comment

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

So, you don't need to wait for the DOM to be ready to start the API request, but we do need the DOM to be ready to do things like detect the doc tool and any other operation that queries the DOM.

I might be missing something here, but it seems like this should add domReady into the promise chain after the API request. Does that seem correct?

The effect without this is that there could be network speed, timeouts, etc that allow our API requests to return before the DOM is ready, and then we'd probably get some nondeterministic behavior around DOM queries.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that's true 👍🏼

@humitos
Copy link
Member Author

humitos commented Feb 4, 2025

I'm closing this since we are performing some heuristic in the DOM to know what type of documentation tool users are using. It's safer to keep running our code when DOM's ready.

@humitos humitos closed this Feb 4, 2025
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