sepehr 8d95f34fcc fix: Add debounced Undo/Redo system to avoid character-by-character history
- Add debounced state updates for title and content (500ms delay)
- Immediate UI updates with delayed history saving
- Prevent one-letter-per-undo issue
- Add cleanup for debounce timers on unmount
2026-01-04 14:28:11 +01:00

33 lines
726 B
JavaScript

// src/jsx/dom/components.ts
import { DOM_ERROR_HANDLER } from "../constants.js";
import { Fragment } from "./jsx-runtime.js";
var ErrorBoundary = (({ children, fallback, fallbackRender, onError }) => {
const res = Fragment({ children });
res[DOM_ERROR_HANDLER] = (err) => {
if (err instanceof Promise) {
throw err;
}
onError?.(err);
return fallbackRender?.(err) || fallback;
};
return res;
});
var Suspense = (({
children,
fallback
}) => {
const res = Fragment({ children });
res[DOM_ERROR_HANDLER] = (err, retry) => {
if (!(err instanceof Promise)) {
throw err;
}
err.finally(retry);
return fallback;
};
return res;
});
export {
ErrorBoundary,
Suspense
};