Skip to content

Commit 1208424

Browse files
committed
Remove dead mobileComposerExpandFrameRef and cancelPendingExpandFocus
The ref was never assigned a non-null value after the refactoring to synchronous focus. This made cancelPendingExpandFocus always a no-op and the cleanup effect for this ref dead code. Remove the ref, callback, interface member, and test assertion.
1 parent 34f4646 commit 1208424

3 files changed

Lines changed: 0 additions & 14 deletions

File tree

apps/web/src/components/chat/ChatComposer.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,6 @@ export const ChatComposer = memo(
813813
const composerMenuItemsRef = useRef<ComposerCommandItem[]>([]);
814814
const activeComposerMenuItemRef = useRef<ComposerCommandItem | null>(null);
815815
const composerBlurFrameRef = useRef<number | null>(null);
816-
const mobileComposerExpandFrameRef = useRef<number | null>(null);
817816
const mobileComposerExpandReleaseFrameRef = useRef<number | null>(null);
818817
const mobileComposerExpandInFlightRef = useRef(false);
819818
const dragDepthRef = useRef(0);
@@ -1636,12 +1635,6 @@ export const ChatComposer = memo(
16361635
composerBlurFrameRef.current = null;
16371636
}
16381637
},
1639-
cancelPendingExpandFocus: () => {
1640-
if (mobileComposerExpandFrameRef.current !== null) {
1641-
window.cancelAnimationFrame(mobileComposerExpandFrameRef.current);
1642-
mobileComposerExpandFrameRef.current = null;
1643-
}
1644-
},
16451638
cancelPendingRelease: () => {
16461639
if (mobileComposerExpandReleaseFrameRef.current !== null) {
16471640
window.cancelAnimationFrame(mobileComposerExpandReleaseFrameRef.current);
@@ -1844,9 +1837,6 @@ export const ChatComposer = memo(
18441837
if (composerBlurFrameRef.current !== null) {
18451838
window.cancelAnimationFrame(composerBlurFrameRef.current);
18461839
}
1847-
if (mobileComposerExpandFrameRef.current !== null) {
1848-
window.cancelAnimationFrame(mobileComposerExpandFrameRef.current);
1849-
}
18501840
if (mobileComposerExpandReleaseFrameRef.current !== null) {
18511841
window.cancelAnimationFrame(mobileComposerExpandReleaseFrameRef.current);
18521842
}

apps/web/src/components/chat/mobileComposerFocus.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ describe("expandMobileComposerForKeyboard", () => {
77

88
expandMobileComposerForKeyboard({
99
cancelPendingBlur: vi.fn(() => calls.push("cancel-blur")),
10-
cancelPendingExpandFocus: vi.fn(() => calls.push("cancel-expand-focus")),
1110
cancelPendingRelease: vi.fn(() => calls.push("cancel-release")),
1211
setExpandInFlight: vi.fn((inFlight) => calls.push(`in-flight:${inFlight}`)),
1312
commitExpandedState: vi.fn(() => calls.push("commit-expanded")),
@@ -17,7 +16,6 @@ describe("expandMobileComposerForKeyboard", () => {
1716

1817
expect(calls).toEqual([
1918
"cancel-blur",
20-
"cancel-expand-focus",
2119
"cancel-release",
2220
"in-flight:true",
2321
"commit-expanded",

apps/web/src/components/chat/mobileComposerFocus.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export interface MobileComposerExpandOptions {
22
cancelPendingBlur: () => void;
3-
cancelPendingExpandFocus: () => void;
43
cancelPendingRelease: () => void;
54
setExpandInFlight: (inFlight: boolean) => void;
65
commitExpandedState: () => void;
@@ -10,7 +9,6 @@ export interface MobileComposerExpandOptions {
109

1110
export function expandMobileComposerForKeyboard(options: MobileComposerExpandOptions) {
1211
options.cancelPendingBlur();
13-
options.cancelPendingExpandFocus();
1412
options.cancelPendingRelease();
1513
options.setExpandInFlight(true);
1614
options.commitExpandedState();

0 commit comments

Comments
 (0)