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
This commit is contained in:
39
mcp-server/node_modules/hono/dist/utils/concurrent.js
generated
vendored
Normal file
39
mcp-server/node_modules/hono/dist/utils/concurrent.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// src/utils/concurrent.ts
|
||||
var DEFAULT_CONCURRENCY = 1024;
|
||||
var createPool = ({
|
||||
concurrency,
|
||||
interval
|
||||
} = {}) => {
|
||||
concurrency ||= DEFAULT_CONCURRENCY;
|
||||
if (concurrency === Infinity) {
|
||||
return {
|
||||
run: async (fn) => fn()
|
||||
};
|
||||
}
|
||||
const pool = /* @__PURE__ */ new Set();
|
||||
const run = async (fn, promise, resolve) => {
|
||||
if (pool.size >= concurrency) {
|
||||
promise ||= new Promise((r) => resolve = r);
|
||||
setTimeout(() => run(fn, promise, resolve));
|
||||
return promise;
|
||||
}
|
||||
const marker = {};
|
||||
pool.add(marker);
|
||||
const result = await fn();
|
||||
if (interval) {
|
||||
setTimeout(() => pool.delete(marker), interval);
|
||||
} else {
|
||||
pool.delete(marker);
|
||||
}
|
||||
if (resolve) {
|
||||
resolve(result);
|
||||
return promise;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
};
|
||||
return { run };
|
||||
};
|
||||
export {
|
||||
createPool
|
||||
};
|
||||
Reference in New Issue
Block a user