Conversation
TODO: make this consistent with removing/adding editors
erikian
approved these changes
Nov 20, 2025
dsanders11
reviewed
Nov 22, 2025
Member
dsanders11
left a comment
There was a problem hiding this comment.
Let's leave it for a follow-up PR, but we should build on this to fix bugs with the gist uploading. Currently if you just spam the "Update" button you'll upload a bunch of empty revisions to the gist because we unconditionally do updates and GitHub is happy to take them as empty commits it appears.
We'll want to update src/renderer/components/commands-action-button.tsx to only do the initial revision after publishing if the content has changed from the default (edge case), and also only update the gist if the content has changed.
We can also disable the "Update" button depending on the isEdited state so that it's clear when you actually have changes to upload to the gist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
In its current state, Fiddle marks the current document as "edited" as soon as a change is made when the saved state applies. This means there's no going back to a "Saved" state even if you Undo all your changes.
Solution
This PR saves a Map of SHA-1 hashes generated via
window.crypto.subtle.digestfor each file and derives theisEditedproperty via a getter function instead:This makes it so that:
isEditedstate is more intuitive to users (prior to this, it was just "was this untouched since the last saved state?")isEditedstate for each file individually.Reviewer notes
The diff here got pretty big, but the core logic just lives in
src/renderer/editor-mosaic.ts. Most of the diff follows from that:digestfunction is asynchronous, anything that sets editor contents is now anasyncfunction.There's just one big ugly hack where the save state gets loaded on a timeout because it's a bit tricky to properly wait for when all content is being properly stored and to figure out when to save the hash: