-
-
Notifications
You must be signed in to change notification settings - Fork 18
Occasionally not loading code until I reload page #9
Comments
Happy to hear you like the plugin! It never happened to me before (I've the plugin implemented in https://daviddalbusco.com). That said, we can try to find a solution ;) Spontaneously I have the feeling that these Web Component underneath, for those without cards, doesn't seems to be loaded. If you debug did you notice the shadow root in the DOM tree?
If not, it is definitely a sign that the component is not loaded. If it is the case, in which component did you add the import?
Finally, do you see any error in the debugger's console? |
Hey! So, yes i'm seeing the shadow root on the DOM tree and I can even see my code inside it. I'm importing this on my layout component, and I'm executing the 'deckDeckGoHighlightElement()' inside a useEffect. Also tried doing this is another component and in a different way but I had the same problem. Occasionally I'm seeing this error - https://ibb.co/5r7XVd8 Thanks for the quick reply! |
Thank you for the feedback. Indeed it does looks like the component is correctly loaded. Can you provide some code respectively not screenshot? Doing so I would be able to debug. And with code I mean the piece of code, the slots, which are not rendered and what type of Thanks in advance for the details. |
Sure!
If you want to, I've deployed this and this is one of the pages where this happens. But as I said, it's totally random - it may happen or not. https://agitated-booth-57253c.netlify.app/tips/post-124 |
Thx for all the details! Yes weird totally random, tried a couple of times and only faced the problem once...weird I'll have a look again later on tonight (UTC+2 here). |
Seems that time to time the following mistake is throw by unpkg when the component tries to fetch the html language:
Which makes sense because there isn't such language to download. In the component I wrap a try/catch around the fetch to ignore the error if it happens, not sure why then time to time it isn't displayed |
Ok I think I can reproduce the error not randomly
My guess is that doing so the component aren't reloaded and somehow because of the fetch error it doesn't display anything... |
Gotcha! Wait for it :) |
@nixton9 update let me know if it works out or not, if not of course I'll be happy to reopen the issue. thx for your time and for using the plugin! |
Just tried it out and seems all perfect, haven't seen the problem anymore! |
Awesome, thx for the feedback and your help! |
I'm using v2.0.0 and am having the same issue. If I had to guess it has something to do with how the service worker is caching JS data.
Solution Instead of having the init code -
in my index.js at the top, I have instead moved it into my Layout.js and put the
|
@matthewmullin01 your repo is open source, can I give it a try? If yes, can you also explains me how to reproduce the issue? For sure if we can manage to reproduce it, happy to reopen this one or to open a new bug. Thanks in advance for your help. |
Hi @peterpeterparker, I'm facing the same issue in my blog at the moment. Sometimes it loads, and sometimes I have to refresh a couple of times before the code loads. When it doesn't, I get the following error in the navigator's console: and some of the code snippets look like this: Here's a link to the blogpost in question, and to its source I implemented @matthewmullin01 's solution in my layout and it still doesn't work. You can find the layout here, my blog is open-source. I'm using v3.0.1 for Thanks! |
@miguelgondu I was not able to reproduce the issue, what browser + version are you using when you are facing the issue? |
I'm using Chrome 95.0.4638.69 (Official Build) (x86_64). I face this issue both when developing locally and in the production build (which is the blogpost I sent). The language is I will update to the newest |
@miguelgondu thx for the details. I was able to reproduce it, it seems to be an issue related to loading the languages within the web component. Follow following issue I just opened 👉 deckgo/deckdeckgo#1387 |
Thanks!, it means a lot. Great work with the plugin. It's super good. |
@miguelgondu just published a fix to npm, can you give a try to of course if not, happy to have a look at it again. |
sh*t my bad, sorry, forgot something if multiple languages are used in the same page. if you don't mind can you try |
@miguelgondu I also bumped the plugin Thanks for your help 👍 |
It works like a charm! I love the plugin. Thank you for all the help. |
Awesome! Thanks for the feedback 🥳 |
First of all, thanks for this plugin. It's super handy and looks really good!
I'm facing a problem where, only sometimes, the card appears but it just does not load the code inside. If I reload the page, the code loads and everything gets right.
I'm 99% sure that until now this only happened to me on HTML cards.
As you can see in this image - https://ibb.co/MV5jNWw - the first card that had HTML did not load the code while the other with CSS loaded it.
Is this a known issue?
The text was updated successfully, but these errors were encountered: