urql-devtools icon indicating copy to clipboard operation
urql-devtools copied to clipboard

Fix assumption of "localStorage" presence when persisting request state

Open Hypermona opened this issue 4 years ago • 9 comments

About

Devtools does not detect a running instance of urql.

Reproduction

  1. Clone this example project
  2. Run yarn install
  3. Run yarn start
  4. Open chrome and navigate to http://localhost:8080
  5. Open the urql devtools panel

Expected result

  • Extension detects app

Actual result

  • Extension shows message "Waiting for exchange"

Stack trace

Error: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
  at la (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:6:58506)
  at Qo (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1043871)
  at ws (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1089921)
  at yu (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1082663)
  at mu (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1082588)
  at su (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1079618)
  at chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1031259
  at t.unstable_runWithPriority (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1106315)
  at Gi (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1030968)
  at Ji (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1031204)

Additional info

environment version
browser Chrome 69
urql 0.0.0
urql devtools 0.0.0
@urql/devtools 0.0.0

Hypermona avatar Jun 25 '21 15:06 Hypermona

Hey there, thanks for the report!

Looks like this issue is caused by https://github.com/FormidableLabs/urql-devtools/pull/350.

@ValGeorgiev was local storage working for you in the browser extension?

andyrichardson avatar Jun 28 '21 08:06 andyrichardson

Is there a work-around?

frederikhors avatar Aug 28 '21 19:08 frederikhors

HI @frederikhors, for now there isn't - I just tried to reproduce the issue but haven't had any luck.

I'm guessing this is related to the browser being used - would be great if yourself or @Hypermona can share what browser and version you're experiencing this on.

andyrichardson avatar Aug 30 '21 12:08 andyrichardson

Chrome 92 Windows 10.

frederikhors avatar Aug 30 '21 13:08 frederikhors

It can be reproduced in Chrome 93, but only in Incognito Mode. Tried disabling "Privacy Sandbox" but to no avail.

raduflp avatar Sep 13 '21 10:09 raduflp

@andyrichardson Is anyone expected to work on it?

frederikhors avatar Dec 09 '21 10:12 frederikhors

Had the same issue. After deactivating "Block third-party cookies", the extension works (I believe you can also add an exception for localhost instead of disabling this option for all sites). Tested on MacOS and Chrome 99: image

pantajoe avatar Mar 19 '22 14:03 pantajoe

Hey folks, sounds like this is due to having third party cookies blocked as @pantajoe has discovered - enabling them for the time being should get around the issue.

I'll leave this open as this can likely be resolved by introducing a check to see whether localStorage is available (see here) before storing cross-session state.

andyrichardson avatar Aug 01 '22 15:08 andyrichardson

Will this ever be fixed? This issue appears stale and still a problem in 2023

peter-olom avatar Nov 06 '23 22:11 peter-olom