Skip to content
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

Presentation making constant per-second full page & source map queries during visual editing #1266

Open
narration-sd opened this issue Apr 5, 2024 · 0 comments

Comments

@narration-sd
Copy link

narration-sd commented Apr 5, 2024

Describe the bug

During actual Visual Editing, post-setup, and without any editing, actually being done, there's a stream of XHR GETs showing in the browser Network console, one per second, requesting and receiving full document data, along with its sourcemap.

To Reproduce

Open Presentation visual editing on a document, in the Studio as normal. Open and observe the browser devtools Network tab.

I backed up development a month, to see if this is a recent problem -- seems not.

No unusual errors were showing on the Console, until I introduced simple console.logging for onConnect in store.useLiveMode options. The delay this caused before reconnect initiation allowed the following error message to show from the Channel controller:

Received no response to message 'loader/query-change' on client 'presentation' (ID: 'c4f659dc-03bf-4c1a-9101-3f129f64981b').

 [controller.ts:324:18](http://localhost:4321/node_modules/@sanity/channels/src/controller.ts)

Without bringing up and troubleshooting the controller code here locally, it seems reasonable to suspect this missing response and the reconnect that follows is setting off the full external requery back to Sanity's api.

I had a very nice conversation with Rupert @rdunk over aspects of the problem, who stepped in from the London office on a Discord query on the problem. Afterwards I verified I think via Sanity logs that while indeed there were (27,000 in few days light testing) of these reconnect queried, they were not showing as billable accesses.

This takes the pressure off, and I'm fully aware of the effort level in development these day. In due course, then, I imagine keep-alive on the Presentation channels shouldn't need wire queries, at least of this magnitude, and imagine you'll want to look into that, possibly finding something easy about the lost message response.

Expected behavior

I'd think channel keep-alive actually shouldn't involve wire traffic, or if that's checked, not once per second, and not making a full document data and sourcemap query. Any that it does end up requiring, should be assured and documented that they will not affect billable resource use, so that everyone can remain confident of this.

Screenshots
data above was from screen; better in text form to be used

Which versions of Sanity are you using?

$ sanity versions
@sanity/cli (global) 3.36.4 (up to date)
@sanity/core-loader 1.6.3 (latest: 1.6.4)
@sanity/react-loader 1.9.6 (latest: 1.9.7)
@sanity/visual-editing 1.8.5 (latest: 1.8.6)

What operating system are you using?
Window 11 entirely latest up-to-date, well-provisioned

Which versions of Node.js / npm are you running?

$ npm -v && node -v
10.2.4
v20.11.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant