urql-graphql / urql-devtools

A tool for monitoring and debugging urql during development
https://formidable.com/open-source/urql/docs/advanced/debugging/#devtools
MIT License
257 stars 11 forks source link

Fix assumption of "localStorage" presence when persisting request state #374

Open Hypermona opened 3 years ago

Hypermona commented 3 years ago

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
andyrichardson commented 3 years ago

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?

frederikhors commented 3 years ago

Is there a work-around?

andyrichardson commented 3 years ago

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.

frederikhors commented 3 years ago

Chrome 92 Windows 10.

raduflp commented 3 years ago

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

frederikhors commented 2 years ago

@andyrichardson Is anyone expected to work on it?

pantajoe commented 2 years ago

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

andyrichardson commented 2 years ago

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.

peter-olom commented 1 year ago

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