release: 1.1.0
TallyNote release / linux-x64 (push) Successful in 6m24s

This commit is contained in:
Qiufeng
2026-08-31 20:11:34 +08:00
parent cbe0d65320
commit 12495fb6a4
66 changed files with 4315 additions and 77 deletions
@@ -0,0 +1,19 @@
import { createContext, type Context } from "react";
export type UnsavedContextValue = {
registerWarning: (id: string, message: string | null) => void;
requestDiscard: (action: () => void) => void;
};
/*
* Vite Fast Refresh can re-evaluate a module while an existing route tree is
* still mounted. Keep the context identity on the browser window so the old
* provider and the refreshed consumers continue to refer to the same object.
*/
type ContextRegistry = Window & {
__tallynoteUnsavedContext?: Context<UnsavedContextValue | null>;
};
const registry = typeof window === "undefined" ? null : window as ContextRegistry;
export const UnsavedContext: Context<UnsavedContextValue | null> = registry?.__tallynoteUnsavedContext ?? createContext<UnsavedContextValue | null>(null);
if (registry && !registry.__tallynoteUnsavedContext) registry.__tallynoteUnsavedContext = UnsavedContext;