tldraw icon indicating copy to clipboard operation
tldraw copied to clipboard

[Bug]: Copy-pasting from tldraw.com to the file using VSCode Plugin produces empty `"records"` field

Open TheKnarf opened this issue 1 year ago • 2 comments

What happened?

  • Create a diagram on tldraw.com
  • Install the VSCode plugin for Tldraw
  • Create an empty file called something.tldr, opening it shows an empty drawing
  • Copy-paste a diagram from tldraw.com into the VSCode plugin
  • The diagram shows up in editor but the file have an empty "records" field

To fix:

  • Simply edit anything in the diagram and then save.

How can we reproduce the bug?

See steps above ^

What browsers are you seeing the problem on?

Chrome

Contact Details

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

TheKnarf avatar Jun 14 '24 10:06 TheKnarf

Hey! Could you please try this again and let us know if you still see it? I'm suspecting the website and the VS Code were not on the same version when that happened.

MitjaBezensek avatar Jun 21 '24 12:06 MitjaBezensek

Screenshot 2024-09-13 at 10 39 48

Works even worse now... Can't even open a new empty file.

What happened?

  • Install the VSCode plugin for Tldraw
  • Create an empty file called something.tldr, opening it and it crashes...

TheKnarf avatar Sep 13 '24 08:09 TheKnarf

Can you tell us a bit more:

  • What version of the extension are you using?
  • What's your VS Code version?

I tried it on VS Code Version: 1.91.1 and tldraw v2.12.0 and it does seem to work for me, so it must be some difference in our environments.

https://github.com/user-attachments/assets/fedd370e-0351-407f-b1de-742b685dd330

MitjaBezensek avatar Sep 13 '24 08:09 MitjaBezensek

Restarted VSCode and it now shows an empty file again. So might have been a version problem. But my original reported problem seems to persist:

Screenshot 2024-09-13 at 11 17 22

Screenshot 2024-09-13 at 11 18 39

tldraw extension v2.12.0

TheKnarf avatar Sep 13 '24 09:09 TheKnarf

You definitely need to save the document for the change to persist to the file, it's the same as with regular text files - just pasting won't persist it on disk. That said, just pasting should mark the file as dirty. When I paste I get this dot notifying me that I have unsaved changes in the file. Does this not happen to you? Does it only appear after making another change?

image

MitjaBezensek avatar Sep 13 '24 11:09 MitjaBezensek

Not getting any dot.

TheKnarf avatar Sep 13 '24 11:09 TheKnarf

https://github.com/user-attachments/assets/a64e465c-cb0b-43fe-b861-4dabc9854859

TheKnarf avatar Sep 13 '24 11:09 TheKnarf

Thanks for the info, will investigate. Seems like the dirty tracking is not working as it should in this case.

MitjaBezensek avatar Sep 13 '24 11:09 MitjaBezensek

We just released a new pre release version that should fix this issue. Could you give it a try and let me know if it now works? To install a prerelease version you can go to the extension manager, select tldraw, then click the switch to prerelease: CleanShot 2024-09-20 at 15 16 29@2x

MitjaBezensek avatar Sep 20 '24 13:09 MitjaBezensek