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 duplicate from creating any shapes if we reach max allowed shapes #3692

Closed MitjaBezensek closed 2 weeks ago

MitjaBezensek commented 2 weeks ago

This prevents duplicating shapes if we get to the max allowed shapes. Before this change we would create as many shapes as we could and skip the rest. After this change we don't create any shapes in this case.

We already do this for copy pasting (via putContentOntoCurrentPage), so no change was needed there.

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

Change Type

Test Plan

  1. Create close to 2000 shapes.
  2. Select so many shapes that duplicating them would go over the 2000 shapes per page limit.
  3. Duplicate.
  4. You should not create any shapes even if there is space for some of them.

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 1:13pm
1 Ignored Deployment | Name | Status | Preview | Updated (UTC) | | :--- | :----- | :------ | :------ | | **tldraw-docs** | ⬜️ Ignored ([Inspect](https://vercel.com/tldraw/tldraw-docs/HvVR2pWaUiS5ZQrW5mQMYM2m6cr1)) | [Visit Preview](https://tldraw-docs-git-mitja-duplicate-shapes-tldraw.vercel.app) | May 3, 2024 1:13pm |
hossain666 commented 2 weeks ago

https://github.com/tldraw/tldraw/pull/3692