-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix: Always use gistId from URL for sharing, prevent duplicate gist creation #511
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
Conversation
@zimiovid is attempting to deploy a commit to the dottle's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Thanks for the pr!
Let's add
setGistId(shareId)
in loadFromGist()
for now
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fix the formatting as well? The semicolon, the spaces
My bad. Got it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you!
…on (drawdb-io#511) * fix: prevent duplicate gist creation * feat: change from useEffect to loadFromGist * Update Workspace.jsx
Problem:
Currently, when opening a diagram via a share link (
?shareId=...
), thegistId
is not always set correctly in the app state. As a result, when the user tries to share again, a new gist is created instead of updating the existing one. This leads to unnecessary gist duplication and breaks the expected collaborative workflow.Solution:
gistId
from theshareId
URL parameter if present.gistId
.Code changes:
Workspace.jsx
, add auseEffect
to setgistId
from the URL on mount:Share.jsx
, use the currentgistId
for patching, and only create a new gist ifgistId
is empty:Result: