refactor(autosave): drop unused handleMentionsChange + getPendingMentions exports
Felix #2: both were exported anticipating a future use that never came — the editor only emits text+mentions through handleTextChange. Dead public surface invites stale code; ship the smaller API. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -23,10 +23,6 @@ export function createBlockAutoSave({ saveFn, documentId }: Options) {
|
|||||||
saveStates.set(blockId, state);
|
saveStates.set(blockId, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPendingMentions(blockId: string, fallback: PersonMention[]): PersonMention[] {
|
|
||||||
return pendingMentions.get(blockId) ?? fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function executeSave(blockId: string): Promise<void> {
|
async function executeSave(blockId: string): Promise<void> {
|
||||||
const text = pendingTexts.get(blockId);
|
const text = pendingTexts.get(blockId);
|
||||||
if (text === undefined) return;
|
if (text === undefined) return;
|
||||||
@@ -90,12 +86,6 @@ export function createBlockAutoSave({ saveFn, documentId }: Options) {
|
|||||||
scheduleDebounce(blockId);
|
scheduleDebounce(blockId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleMentionsChange(blockId: string, mentionedPersons: PersonMention[]): void {
|
|
||||||
pendingMentions.set(blockId, mentionedPersons);
|
|
||||||
// Mentions changes always accompany text changes from the editor, so the
|
|
||||||
// text-debounce timer covers them too.
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleBlur(): void {
|
function handleBlur(): void {
|
||||||
for (const [blockId] of [...debounceTimers]) {
|
for (const [blockId] of [...debounceTimers]) {
|
||||||
clearDebounce(blockId);
|
clearDebounce(blockId);
|
||||||
@@ -150,9 +140,7 @@ export function createBlockAutoSave({ saveFn, documentId }: Options) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
getSaveState,
|
getSaveState,
|
||||||
getPendingMentions,
|
|
||||||
handleTextChange,
|
handleTextChange,
|
||||||
handleMentionsChange,
|
|
||||||
handleBlur,
|
handleBlur,
|
||||||
handleRetry,
|
handleRetry,
|
||||||
clearBlock,
|
clearBlock,
|
||||||
|
|||||||
Reference in New Issue
Block a user