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 rendering duplicate Vue-related script elements on book pages #8517

Merged

Conversation

jimchamp
Copy link
Collaborator

Closes #8493

The render_component function, when called for the first time, appends a script element which pulls in Vue. It also renders a script element for the specific component the first time that component is rendered on a page.

The first time that render_component is called on the book page is in the edition/modal_links template. Prior to these code changes, the rendered modal links were stored in a variable which was rendered twice in databarWork.html, resulting in duplicate script tags.

Since rendering the edition/modal_links template takes very little time, render_template is now called both times the modal links are rendered.

Technical

Testing

Screenshot

Stakeholders

@cdrini cdrini self-assigned this Nov 13, 2023
Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

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

Nice lgtm! Testing on testing.openlibrary.org . The modal opens, works like a charm, and doesn't load vue twice!

@cdrini cdrini merged commit 3687454 into internetarchive:master Nov 13, 2023
2 checks passed
@jimchamp jimchamp deleted the 8493/bug/avoid-duplicate-script-tags branch November 16, 2023 17:17
@cdrini cdrini added the Theme: Performance Issues related to UI or Server performance. [managed] label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Theme: Performance Issues related to UI or Server performance. [managed]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vue, ObservationForm JS loaded twice on books page; 130kb JS
2 participants