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

Consider loading the MermaidConfig within the Mermaid Block #13

Closed
ichim-david opened this issue Feb 6, 2024 · 3 comments · Fixed by #16
Closed

Consider loading the MermaidConfig within the Mermaid Block #13

ichim-david opened this issue Feb 6, 2024 · 3 comments · Fixed by #16
Assignees
Labels
bug Something isn't working

Comments

@ichim-david
Copy link

https://github.com/plonegovbr/volto-code-block/blob/main/src/index.js#L38

Due to the AppExtender this package loads on every pages an external js
regardless of the use or not of the functionality of the MermaidBlock.
Ideally, the resources should be loaded only when using the block keeping
resource loading slim and focused

@ichim-david
Copy link
Author

@ericof might be worth investigating this issue I've raised

@ericof
Copy link
Contributor

ericof commented Feb 9, 2024

@sneridagh Any idea how I can handle this?

@ericof ericof added the bug Something isn't working label Feb 9, 2024
@ericof ericof self-assigned this Feb 9, 2024
@ichim-david
Copy link
Author

@ericof I'm no @sneridagh but I think one solution could be to simply try to load it on mount within the component using this technique
https://www.altcademy.com/blog/how-to-load-js-src-from-script-tag-in-reactjs/#using-useeffect-hook-to-load-external-js-files
This way you avoid adding something that is not used but loaded everywhere due to the AppExtras.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants