feat(notes): auto-merge non-overlapping edits on conflict
All checks were successful
CI / verify (push) Successful in 1m13s
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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user