-
Notifications
You must be signed in to change notification settings - Fork 125
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
style tag append every time when we navigate api tab while using CDN link #1724
Comments
Thanks for bringing this up! Related issue: #1340 |
@hanspagel I check #1340 issue but still I am getting problem. |
Sure! Just wanted to cross link both issues. We’re using |
@hanspagel @jatingajera31 there is a fix possible for this now with the new events. Just place the script tag outside of the page so it only gets loaded once, then you can trigger the custom event when you navigate to the page to reload the references document.dispatchEvent(new Event('scalar:reload-references')) but yes we should also only load the js and styles once |
@jatingajera31 if you want to put up a minimal reproduction or just your code in general I can try and help |
@amritk here is the code `import { AfterViewInit, Component, OnDestroy, OnInit, Renderer2 } from '@angular/core'; @component({ ngOnInit(): void { ngOnDestroy(): void { ngAfterViewInit(): void { private loadScript(url: string): Promise { html code file |
Alright I tested it and you are correct, even with the new events we still can't get it working in angular due to attaching the references to the body instead of the dom element inside the view. I think we should just make an angular integration at some point. I will open a ticket |
You can track the work here |
@amritk Thank you for ticket. |
not sure, @hanspagel what do yo think |
Great you‘ve found a workaround! 🙌 As a general solution for our published version I’d still take the approach mentioned above: |
What happens?
I am using this scaler CDN link : https://cdn.jsdelivr.net/npm/@scalar/[email protected]
when i navigate other tab and back to swagger api tab every time new style tag is appending and it will impact on performance and speed
What did you expect to happen?
The internal style append only once.
How can we reproduce the issue?
1 Setup CDN in Angular project.
2 Setup API documentation page in particular url.
3 Navigate to another page.
4 Go to the existing page on which we loaded the API documentation via CDN link
5 See head tag style in DOM via inspect element in browser
Swagger/OpenAPI Example
No response
The text was updated successfully, but these errors were encountered: