Skip to content

Commit

Permalink
Prevent slurping for some cases. (tldraw#5272)
Browse files Browse the repository at this point in the history
Make sure we don't slurp into files that we don't own and that we don't
overwrite existing data.

### Change type
- [x] `improvement`
  • Loading branch information
MitjaBezensek authored Jan 23, 2025
1 parent 7c5f960 commit 0d2df55
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ function WelcomeDialog() {
])

if (data.loading) return null
const offerSlurp = data.ok && data.value
const file = app.getFile(fileId)
const isOwner = file && file.ownerId === app.getUser().id
const isEmpty = editor.store.allRecords().filter((r) => r.typeName === 'shape').length === 0
const offerSlurp = data.ok && data.value && isEmpty && isOwner

return (
<div>
Expand Down

0 comments on commit 0d2df55

Please sign in to comment.