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

[pull] main from tldraw:main #1

Open
wants to merge 1,432 commits into
base: main
Choose a base branch
from
Open

[pull] main from tldraw:main #1

wants to merge 1,432 commits into from

Conversation

pull[bot]
Copy link

@pull pull bot commented Feb 3, 2024

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

Copy link

restack-app bot commented Feb 3, 2024

No applications have been configured for previews targeting branch: main. To do so go to restack console and configure your applications for previews.

Copy link

semanticdiff-com bot commented Feb 3, 2024

Review changes with  SemanticDiff

Copy link

pr-code-reviewer bot commented Feb 3, 2024

👋 Hi there!

In the first code-diff, the change apps/dotcom-worker/.dev.vars to apps/dotcom/*-worker/.dev.vars seems important for broader file inclusion. In the second diff, the removal of specific directories and files from .eslintignore enhances linting by focusing on relevant code areas. Ensure changes align with project requirements and standards.


Automatically generated with the help of gpt-3.5-turbo.
Feedback? Please don't hesitate to drop me an email at webber@takken.io.

Copy link

coderabbitai bot commented Feb 3, 2024

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

instapr bot commented Feb 3, 2024

The link you provided in the PR body seems to be broken. Please update it or provide more details about the changes made in this pull request.

@pull pull bot added the ⤵️ pull label Feb 3, 2024
Copy link

restack-app bot commented Feb 13, 2024

No applications have been configured for previews targeting branch: main. To do so go to restack console and configure your applications for previews.

Copy link

astronuts-ai bot commented May 2, 2024

GitHub PRs

steveruizok and others added 20 commits November 26, 2024 15:27
This PR further updates design / spacing, especially on mobile / safari.

- share menu spacing
- unified cta button for share / sign in button
- signed out export/share menu button spacing / background / color
- reduce top right padding on mobile

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`

---------

Co-authored-by: Mitja Bezenšek <mitja.bezensek@gmail.com>
Throttles them (3s). Uses different messages for different error codes.

You can test this by setting `rateLimited` to `true` and sending
different `ZErrorCodes`
[here](https://github.com/tldraw/tldraw/blob/eb0cbe7e18aaee9f017de2e6c2ce360130cd2fe9/apps/dotcom/sync-worker/src/TLUserDurableObject.ts#L171-L188).

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
Appearance
<img width="624" alt="image"
src="https://github.com/user-attachments/assets/61f1b81d-d82c-4d2f-8a95-7bc6bb3792d9">
Tooltip
<img width="529" alt="Screenshot 2024-11-26 at 11 04 22"
src="https://github.com/user-attachments/assets/96186118-9c24-409c-9a57-61d130f02a81">
No avatar
<img width="571" alt="image"
src="https://github.com/user-attachments/assets/db95cd8b-a1e5-47dc-bb35-186370543c5f">

No name
<img width="614" alt="Screenshot 2024-11-26 at 11 09 00"
src="https://github.com/user-attachments/assets/663eb29a-8e93-40a6-8809-d93157bebeed">

I tried using the existing `TlaCollaborator` component in the hopes that
we could consolidate with the people menu at some point, but it ended up
looking like shit with the border on the avatar when the file is
selected/hovered. Also not sure the 'first initial' style of avatar that
we use in the people menu is appropriate here. It was feeling rabbit
holey and I think it would take significant work to get that stuff all
working nicely and this PR is not the place to do it. So I just removed
the unused `TlaCollaborator` component for now.

### Change type

- [x] `other`
This PR moves the guest / owner badge to the left side of the item.

### Change type

- [x] `other`
I noticed an issue with `firstVisitAt` not getting getting set when I
was reviewing #4998. The problem was that we didn't set the
`firstVisitAt` when we created a new file. We then didn't allow updating
the `firstVisitAt` field, which meant that it never got populated.

Since we don't allow changing `firstVisitAt` I could also simplify some
other parts of mutating file state.

File state gets created in two cases:
- when we create a file we immediately also create the file state (this
one now correctly sets `firstVisitAt`).
- for guest files we call `onFileEnter` which in turn calls
`getOrCreateFileState` which already correctly set the `firstVisitAt` in
the insert mutation.

### Change type

- [x] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`
fix up bad i18n typing on defineMessages

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
…5005)

This PR adds automatic migrations to `dev-app` and our dotcom deployment
script. It provisions a new postgres instance for each PR, using
https://neon.tech

- By default any state you accumulate in a PR's postgres instance will
persist across commits
- If you want to wipe the db on subsequent commits, add the
`reset-preview-db` label to your PR.



### Change type

- [x] `other`
Don't think these workflows require the higher end machines.

Kept the following workflows on higher machines:
- Checks. Almost always the slowest workflow. Anything we can do to
speed this one up is worth it.
- Deploy-dotcom. We want fast deploys.
- Playwright tests. We parallelize the tests. I lowered the cores for
dotcom since it only uses 2 workers. That said still I had to use 8
cores (even with 4 postgres didn't boot up in time). Examples seems to
use 8 workers when running on 16 core machine and is quite slow, so I
kept it at that.
- All the publish workflows (publish-patch, publish-branch,
publish-canary,...). Unsure if we can lower these ones. We often build
all projects in them so they might benefit from more cores and more ram?

Had to create the 8 core runner in our orgranization -> actions ->
runners.

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
We got an error saying there was a bad request when drag and dropping
files. This is because we wanted to create a file state as the file
owner, but the file did not exist yet (which is not allowed, we only
allow that for guest files). So we now also create a file together with
the file state.


![image](https://github.com/user-attachments/assets/2bde9622-e511-4f84-ad08-b1d6dd54e3cc)

I also noticed that the `createFile` function does not need to be async
and also extracted document names from the files if we have them.

### Change type

- [x] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Test plan

1. Drag some files to the sidebar.
2. They should correctly appear (with the correct names if they have
time) and you should not see any rejected mutation toasts (like the one
above).
redoing #5005 with pooled postgres connections

### Change type

- [x] `other`
whoops left this in
- [x] `other`
App provider is inside the intl provider, so we can just get the intl
and pass it along.

### Change type

- [x] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`
This allows renaming active files when the sidebar has focus and when
you press enter. When the file link becomes active it focuses itself and
when focused it enters rename mode if we press enter.

This also prevents creating a new file if we first click the create file
button and then press enter immediately. The focus changes to the new
file and we will start renaming it.

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Test plan

1. Click create file button.
2. Press enter. You should not see another file getting created.
Instead, you should be in the rename mode for the newly added file.

---------

Co-authored-by: David Sheldrick <d.j.sheldrick@gmail.com>
### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
…5018)

Prevents an issue with editor remounting since we navigate.

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Test plan

1. Create new file.
2. Click on it in the sidebar
3. tldraw editor should not remount.

Co-authored-by: David Sheldrick <d.j.sheldrick@gmail.com>
This enables selective backwards compatibility, i.e. knowing which
version of a client is running so we can accommodate them or force them
to upgrade.

Here's what the latter looks like 
<img width="973" alt="image"
src="https://github.com/user-attachments/assets/c16d3795-d8fa-4d47-ac71-d9d4b68a9ed9">

You can click 'later' and finish up any drawing stuff but you will get
frequent toasts telling you to reload, and app mutations will not be
applied even locally, until you do eventually refresh.

Hopefully this should only ever be seen by people who leave their tabs
running for months at a time. Not sure how we'll do this with zero.

### Change type


- [x] `other`
This PR fixes a bug with long presses where the point would be wrong.

### Change type

- [x] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Test plan

1. Long press on a shape
2. The shape should not move under your pointer

- [x] Unit tests

### Release notes

- Fixed a bug with long press on inset canvases.
steveruizok and others added 30 commits February 6, 2025 14:28
This PR makes several tweaks to landing page copy. It adds the Customers
category to our blog.

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
Looks like this happened only on non-retina screens and was caused by
subpixel rendering.

Resolves INT-720

### Before


https://github.com/user-attachments/assets/1018c07d-4f6e-4af1-ab2c-2b7ddd156e51


### After


https://github.com/user-attachments/assets/332316ec-b0b9-4b5f-afab-67658e2deb23



### Change type

- [x] `improvement`

### Release notes

- Fix the dancing icons when the sidebar width change.
Cute, little change.

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
Just because I noticed it... The nav bar was recently changed and the
Pricing button now does nothing. Was it supposed to be like this?

I also changed the watermark section's ID to "license" as we link to
"#license" elsewhere in the FAQs

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`

### Test plan

1. Check the pricing button works in the navbar of the docs site.
2. Check the "license" button works in the link in the FAQs.

- [ ] Unit tests
- [ ] End to end tests

### Release notes

- Unreleased bug: Fixed some broken links on the docs site.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
When a user zooms in, all of the image or video shapes will run a
debounced function that attempts to resolve a new URL for the asset.
This is part of the LOD work done in #3684 /
#3827. One interesting issue is
that the debounce function itself is relatively expensive. With many _n_
shapes on the canvas, the browser is adding and removing at least _n_
global timers on each frame.

For example, here's me zooming in and out on a bunch of images. The 

<img width="1335" alt="image"
src="https://github.com/user-attachments/assets/0548318a-52fd-44a9-8cee-a5b7dd323d51"
/>

<img width="458" alt="image"
src="https://github.com/user-attachments/assets/cd82014b-e48d-4f82-92bd-54f9280ba797"
/>

To avoid this work, this PR hooks into the editor's tick event, which
fires every 16ms. Rather than debouncing for 500ms, we count the ticks
and add / remove listeners from the editor.

We make a request when the screen size of an image changes. This can
happen when a user resizes a change or when a user changes the zoom. We
could further improve the latter case by firing a "zoom ended" or
"camera settled" event from the editor and only making those requests
then; but we'd still need to "debounce" the resizing story.

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`

### Test plan

1. Make lots of images of any size.
2. Zoom in and out.
3. Check performance tab for smooth sailing.

### Release notes

- Improve zoom performance when many shapes are in a document.
- Updates the doc site to have Hubspot telemetry.
- Adds relevant cookie consent banner/dialogs.
- I also updated the language on botcom to match the .dev
- (somehow there's some extra changes in here from API docs generated)

<img width="355" alt="Screenshot 2025-02-06 at 15 16 24"
src="https://github.com/user-attachments/assets/f79d55a7-7942-4cda-9eb9-a53a31a033cd"
/>
<img width="621" alt="Screenshot 2025-02-06 at 15 16 27"
src="https://github.com/user-attachments/assets/728f1e4f-68a3-43ae-a63a-a71f71bb9323"
/>
<img width="411" alt="Screenshot 2025-02-06 at 15 16 33"
src="https://github.com/user-attachments/assets/25ad6d34-8f67-4820-a2d3-0330d9f9b959"
/>
<img width="686" alt="Screenshot 2025-02-06 at 15 16 36"
src="https://github.com/user-attachments/assets/a750674b-7d71-491a-a22a-4313553ce9c8"
/>
<img width="183" alt="Screenshot 2025-02-06 at 15 41 11"
src="https://github.com/user-attachments/assets/c19bba3e-2e7b-4869-a94a-0971bc82bcdf"
/>
<img width="269" alt="Screenshot 2025-02-06 at 15 46 35"
src="https://github.com/user-attachments/assets/138a495d-b91b-4801-b122-48c95224189e"
/>



### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
This PR uses cookie-less tracking to track the performance of the cookie
permissions popup 🙃

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
…inputs (like the file rename input) (#5378)

We used `hotkeys` library [in the past
t](#5340 add the shortcuts for
numeric tool shortcut keys. Looks like it handled the editable element
filtering (not triggering keyboard shortcuts when the source was an
editable element). Since we no longer use that we should prevent the
shortcuts manually.

### Change type

- [x] `bugfix`

### Test plan

1. Edit the file name in the sidebar.
2. Pressing 1, 2, 3 should no longer change the tool and should add the
pressed key to the name input.

### Release notes

- Fix an issue with numeric shortcuts working inside of editable
elements.
This PR fixes draft articles not appearing in local development.

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
Add some additional tracking (active users in replicator and cold start
time to used do). Added some additional panes to grafana, here's [the
view](https://tldraw.grafana.net/d/adgumkhou3chsd/events?orgId=1&from=now-12h&to=now&timezone=browser&var-environment=pr-5380)
for this pr.

### Change type

- [x] `improvement`

### Release notes

- Add some additional tracking (active users in replicator and cold
start time to used do).
Make sure our compiled localizations are up to date.

Pre-commit [should update the
them](https://github.com/tldraw/tldraw/blob/be65d368fd8b3aaa31b3d6a41b3f563f3312b379/.husky/pre-commit#L7),
but just to be safe we'll double check in CI.

Example of a failed run
[here](https://github.com/tldraw/tldraw/actions/runs/13200772367/job/36852008480?pr=5383#step:13:23)
(and the
[commit](2608484)
that caused it).

### Change type

- [x] `improvement`

### Release notes

- Make sure our compiled localizations are up to date.
This is by no means a perfect solution, but it's a lot better than the
current situation for logged in users, which is bad mainly because it
shows the sidebar. Showing the sidebar for published files:

- fails to give the file owner a sense of how other people will see the
published version
- prevents the viewer from really _feeling_ how published files are
different
- puts the sidebar in a confusing navigational state where nothing is
selected

With this PR

1. Logged in users see the 'anonymous' view (no sidebar) but with a
share button instead of the sign in button.
2. Logged in users also get a 'copy to my files' affordance in the three
dots menu.
3. We replace the 'Save a copy' menu item (which opens the file picker)
with a 'Download file' menu item (which downloads straight to the
downloads folder).
4. Clicking the tldraw logo takes you back to the main app view

I think there's still a lot of room for improvement here, but this feels
like a quick win to land ahead of launch

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`
This PR moves shape-specific options into shape utils as static objects.

I'd initially added shape options to the `options` prop, however like
many other options, they aren't really options to the editor.

By comparison, adding static options to shape utils is less discoverable
but easier to scale and document.

The only negative that I can think of, apart from discoverability, is
that static changes like this effect all editors. This probably doesn't
matter: I can't imagine a single app with two editors, one of which
allows notes to resize and the other which does not.

```tsx
import { NoteShapeUtil, Tldraw } from 'tldraw'
import 'tldraw/tldraw.css'

NoteShapeUtil.options.resizeMode = 'scale'

export default function ResizeNoteExample() {
	return (
		<>
			<div className="tldraw__editor">
				<Tldraw persistenceKey="resize-note"></Tldraw>
			</div>
		</>
	)
}
```

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [x] `api`
- [ ] `other`

### Release Notes
- introduces shape options
- moves (unreleased) `noteShapeResizeMode` to
`NoteShapeOptions.resizeMode`
- moves `maxDrawShapePoints` to `DrawShapeOptions.maxPoints`
- adds `maxPoints` to `HighlightShapeOptions.maxPoints`
- 💥 breaking change if someone was using `options.maxDrawShapePoints`.
This PR updates the i18n strings.

### Change type
- [x] `other`

---------

Co-authored-by: huppy-bot[bot] <128400622+huppy-bot[bot]@users.noreply.github.com>
Co-authored-by: Mime Čuvalo <mimecuvalo@gmail.com>
Dismiss the sidebar after selecting a file on mobile.

### Change type
- [x] `improvement`

### Release notes

- Dismiss the sidebar after selecting a file on mobile.
We use this for associating assets to a file. Looks like we weren't
setting the variable at all.

This only works for files uploaded to the app. Existing legacy rooms
used assets uploader worker, which stores files into a separate folder
in dev mode, so those still won't work.

### Change type

- [x] `improvement`

### Release notes

- Add env variable for local development.
…5396)

Is ready wrapper continued to show the spinner even after we errored
out.

### Change type

- [x] `bugfix`

### Test plan

1. Log in (logged out experience wasn't broken).
2. Got to a non existing legacy room.
3. You should see a `Room not found` error page.

### Release notes

- Show error pages instead of getting stuck on the spinner when logged
in and visiting a legacy route.
Leftovers from a past life? 😄 

### Change type

- [x] `improvement`

### Release notes

- Remove file delete route.
Updates to `fileState` `sessionState` and `file` `updatedAt` fields are
by far the most frequent queries in our DB. Make them a bit less
frequent and also make sure we do flush any pending updates if we
navigate to a different file.
 
### Change type

- [x] `improvement`

### Release notes

- Make updates to file and file state a bit less frequent. Make sure we
flush and pending updates before navigating though.
# 🔪 

This PR gets rid of all the old versions of the legacy routes like
/r/whatever and such.
The new app-enhanced versions still exist obvs.

### Change type

- [x] `other`
This diff tweaks the shape options API added in #5349 so that it's no
longer global. Instead, shape utils have a `.configure()` method, which
accepts a partial of their options and returns a new shape util with
those options applied.

We also tweak the behaviour of passing in custom shape utils to play
nicer with this: previously, if you passed in a shape util with type
"arrow", an error would be thrown complaining about duplicate shape
utils because the default one was already specified. Now, we won't try
to include the default arrow util because we can see you using a custom
one. If you pass two utils with the type "arrow", you'll still get an
error.

### Change type
- [x] `api`

### Release notes

- introduces shape options & `ShapeUtil.configure`, a utility for
passing options to a shape util
- moves (unreleased) noteShapeResizeMode to NoteShapeOptions.resizeMode
- If you pass tldraw a shape util with the same type as a default, it'll
now replace the default rather than crash
- **BREAKING** `options.maxDrawShapePoints` should now be specified with
`DrawShapeUtil.configure({maxPoints})` and
`HighlightShapeUtil.configure({maxPoints})`
Fixes:
* File permissions for non owners.
* File state permissions.
* An issue with the published file logic.

### Change type

- [x] `bugfix`

### Test plan

1. I tested this via `app.updateFile` since we don't expose UI elements
for this.

### Release notes

- Fix a bug with changing files.
Limit the types of urls we allow to be passed through.

### Change type

- [x] `improvement`

### Release notes

- Lock down our image resize worker to only allow asset upload urls to
pass through.
…#5405)

as per @steveruizok request, no delete le slurpy slurp

### Change type

- [ ] `bugfix`
- [ ] `improvement`
- [ ] `feature`
- [ ] `api`
- [x] `other`
Adds an is_signed_in property to posthog events that we can use to
differentiate pageviews.

### Change type

- [x] `other`
add create-user event


- [x] `other`
Read through [cloudflare
docs](https://developers.cloudflare.com/durable-objects/api/stub/) and
[cloudflare
discord](https://discord.com/channels/595317990191398933/1230421736286060584/1231228955357610115)
and came across the following:

> Yes you should be obtaining a new stub instance. This isn't necessary
for every type of error, but is good practice nonetheless.

> If an exception is thrown by a Durable Object stub all in-flight calls
and future calls will fail with
[exceptions](https://developers.cloudflare.com/durable-objects/observability/troubleshooting/).
To continue invoking methods on a remote Durable Object a Worker must
recreate the stub. There are no ordering guarantees between different
stubs.

> Yeah, that's not entirely unexpected. Sometimes a network issue or
internal error will last for long enough to impact both your original
request and the retry. You could potentially try addressing this by
adding a delay between retries, but I would still advise against doing
so as it'll make an operation wait a lot longer to potentially still
fail at the end since it's hard to put bounds on how long that retry
wait time should be.

Feels like it might be safer to always get a new stub. Checked our other
helpers for getting DO and they all seem to be used just in time and are
not stored and reused (except for logger).

### Change type

- [x] `improvement`


### Release notes

- Get a fresh stub each time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.