testing-playground icon indicating copy to clipboard operation
testing-playground copied to clipboard

`a new version is available` notification keeps showing up

Open smeijer opened this issue 5 years ago • 6 comments

Bug Report 🐛

The 'refresh for update' indicator is a bit buggy

refresh-indicator

To Reproduce ✔️

  1. No idea, maybe it's only the netlify preview build?

Expected behavior 🤔

The refresh indicator should only appear once, and be gone when I click "refresh".

Suggested solution 🔦

Your Environment 💻

  • browser: Chrome
  • os: Linux

smeijer avatar Jun 23 '20 17:06 smeijer

Oh, interesting! I wonder if I can recreate that.

Edit: I got it to happen once with setting the if blocks to true but now I need to figure out how to clear the worker lmao Edit2: figured out the service worker stuff, back to recreating and fixing the bug 😅 Edit3: So with the serviceWorker conditionals set to true I am able to render the Toast but I am oddly getting 3 Screen Shot 2020-06-23 at 9 40 04 PM

JacobMGEvans avatar Jun 24 '20 02:06 JacobMGEvans

It seems like the service worker Registration onstatechange() is being called multiple times which is where the toast component lives. Screen Shot 2020-06-28 at 3 52 46 PM

JacobMGEvans avatar Jun 28 '20 20:06 JacobMGEvans

Thanks for the research 👍

I would expect installingWorker.state === 'installed' to handle that. Did you find any useful difference between the events, that we can use to detect the right one?

If not, we can always set and check a file scope notified flag.

smeijer avatar Jun 28 '20 21:06 smeijer

That handled it but there was an additional condition checking the ServiceWorker controller that was null for the first 2 state changes and never seemed to render the toast unless I removed it. Currently, I am trying to see if I can find onstatechange( behavior for installed that will also do it but not have the other renders will null states

JacobMGEvans avatar Jun 28 '20 21:06 JacobMGEvans

@JacobMGEvans, were you able to find a solution for this issue? I consider disabling the notification entirely. Because it's really bugging me.

smeijer avatar Jul 08 '20 08:07 smeijer

Reminder for myself to check this out tomorrow 😅

ljosberinn avatar Jul 24 '20 21:07 ljosberinn