Skip to content

Fix Bootstrap resources #17690

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

Closed
wants to merge 2 commits into from
Closed

Fix Bootstrap resources #17690

wants to merge 2 commits into from

Conversation

MikeAlhayek
Copy link
Member

@MikeAlhayek MikeAlhayek commented Mar 28, 2025

This is not a complete fix but just a concept test. Related to #17686

This should prevent bootstrap from being loaded twice. But, now Bootstrap is no longer available on window. Some scripts like bootstrap-select will not work because it access bootstrap using window.bootstrap.

For this to work, we would have to also convert bootstrap-select to use bootstrap via import. Alternatively, we can add window.bootstrap = bootstrap; to the TheAdmin.ts to make bootstrap available globally to prevent breaking people.

@gvkries can you at least see if this loads the bootstrap twice or is it only once?

@Skrypt
Copy link
Contributor

Skrypt commented Mar 28, 2025

Yeah, the window.bootstrap was a temporary patch up untill we refactored everything to work as ES6 scripts. Because we use Bootstrap everywhere as inline scripts in .cshtml pages. Did not have enough time to refactor everything.

@Skrypt
Copy link
Contributor

Skrypt commented Mar 28, 2025

And to be honest for the size of these files related with importing Bootstrap on everyone of them. I think it is neglectable for now. We can optimize by using the Bloom javascript framework folder over time.

@Skrypt
Copy link
Contributor

Skrypt commented Mar 28, 2025

I'd say merge it if it fixes the issue for now.

@MikeAlhayek
Copy link
Member Author

It does not work until we convert every script that needs access to window.bootstrap to ES and import bootstrap with in. One know script is bootstrap-select.

@gvkries
Copy link
Contributor

gvkries commented Mar 29, 2025

This seems to solve the issue, bootstrap is loaded only once. But even though it fixes the issue, I think separating this specific method is more appropriate solution, because including bootstrap in autocomplete.js is unnecessary bloating the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants