tldraw / tldraw

SDK for creating whiteboards and canvas experiences on the web.
https://tldraw.dev
Other
33.04k stars 1.98k forks source link

Prevent unnecessary fetching of readonly slugs #3663

Closed MitjaBezensek closed 2 weeks ago

MitjaBezensek commented 2 weeks ago

Prevents unnecessary fetching of readonly slugs. We only need to fetch it if we don't have it yet.

There was also a weird issue with window.location.href sometimes returning encoded search params and sometimes decoded ones:

image

This then caused an additional fetch in the setInterval since the urls did not match.

CleanShot 2024-04-30 at 14 37 12

Resolves https://github.com/tldraw/tldraw/issues/3661

Change Type

Test Plan

Opening a multiplayer room

  1. Open a multiplayer room. You should only see one fetch for the readonly slug.

Sharing a local room

  1. Open a local room.
  2. Share it. You should only see one fetch for the readonly slug.

Release Notes

vercel[bot] commented 2 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
examples ✅ Ready (Inspect) Visit Preview May 3, 2024 10:29am
1 Ignored Deployment | Name | Status | Preview | Updated (UTC) | | :--- | :----- | :------ | :------ | | **tldraw-docs** | ⬜️ Ignored ([Inspect](https://vercel.com/tldraw/tldraw-docs/F1zriMGv933hmmaRDcPzgTvafrQG)) | [Visit Preview](https://tldraw-docs-git-mitja-readonly-fetch-tldraw.vercel.app) | May 3, 2024 10:29am |