Add scheduling for draft commits in App.tsx
This commit is contained in:
@@ -645,6 +645,24 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
||||
}
|
||||
};
|
||||
|
||||
const scheduleDraftCommit = (applyChange: () => void) => {
|
||||
window.setTimeout(() => {
|
||||
applyChange();
|
||||
}, 0);
|
||||
};
|
||||
|
||||
const handleNumberInputPointerUp = (_event: ReactPointerEvent<HTMLInputElement>, applyChange: () => void) => {
|
||||
scheduleDraftCommit(applyChange);
|
||||
};
|
||||
|
||||
const handleNumberInputKeyUp = (event: ReactKeyboardEvent<HTMLInputElement>, applyChange: () => void) => {
|
||||
if (!isCommitIncrementKey(event.key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
scheduleDraftCommit(applyChange);
|
||||
};
|
||||
|
||||
const handleSaveDraft = () => {
|
||||
const result = store.saveDraft();
|
||||
setPersistenceMessage(
|
||||
|
||||
Reference in New Issue
Block a user