feat(notes): auto-merge non-overlapping edits on conflict
All checks were successful
CI / verify (push) Successful in 1m13s

When a save hits a GitHub conflict, try a three-way merge first: if our
edits and the remote ones don't overlap, commit the result silently with
a tailored toast. Only genuinely overlapping edits open the conflict
modal. Adds an optional successMessage override to updateFile.
This commit is contained in:
Julien Calixte
2026-06-30 00:27:07 +02:00
parent cb22c755df
commit b8c9d07930
2 changed files with 52 additions and 8 deletions

View File

@@ -88,18 +88,20 @@ export const useGitHubContent = ({
const putFile = async ({
content,
path,
sha
sha,
successMessage = "✅ Note saved"
}: {
content: string
path: string
sha?: string
successMessage?: string
}): Promise<{ sha: string | null; conflict: boolean }> =>
putRaw({
contentBase64: encodeUTF8ToBase64(content),
path,
sha,
message: `Updating ${path} from Remanso`,
successMessage: "✅ Note saved",
successMessage,
conflictMessage: "⚠ Conflict: this note changed on GitHub",
failureMessage: "❌ Note could not be saved"
})
@@ -126,6 +128,7 @@ export const useGitHubContent = ({
content: string
path: string
sha: string
successMessage?: string
}) => putFile(props),
createFile: async (props: { content: string; path: string }) =>
putFile(props),