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.
This commit is contained in:
3 files changed
-14
No files matched your search
@@ -813,7 +813,6 @@ export const ChatComposer = memo(
|
||||
const composerMenuItemsRef = useRef<ComposerCommandItem[]>([]);
|
||||
const activeComposerMenuItemRef = useRef<ComposerCommandItem | null>(null);
|
||||
const composerBlurFrameRef = useRef<number | null>(null);
|
||||
const mobileComposerExpandFrameRef = useRef<number | null>(null);
|
||||
const mobileComposerExpandReleaseFrameRef = useRef<number | null>(null);
|
||||
const mobileComposerExpandInFlightRef = useRef(false);
|
||||
const dragDepthRef = useRef(0);
|
||||
@@ -1636,12 +1635,6 @@ export const ChatComposer = memo(
|
||||
composerBlurFrameRef.current = null;
|
||||
}
|
||||
},
|
||||
cancelPendingExpandFocus: () => {
|
||||
if (mobileComposerExpandFrameRef.current !== null) {
|
||||
window.cancelAnimationFrame(mobileComposerExpandFrameRef.current);
|
||||
mobileComposerExpandFrameRef.current = null;
|
||||
}
|
||||
},
|
||||
cancelPendingRelease: () => {
|
||||
if (mobileComposerExpandReleaseFrameRef.current !== null) {
|
||||
window.cancelAnimationFrame(mobileComposerExpandReleaseFrameRef.current);
|
||||
@@ -1844,9 +1837,6 @@ export const ChatComposer = memo(
|
||||
if (composerBlurFrameRef.current !== null) {
|
||||
window.cancelAnimationFrame(composerBlurFrameRef.current);
|
||||
}
|
||||
if (mobileComposerExpandFrameRef.current !== null) {
|
||||
window.cancelAnimationFrame(mobileComposerExpandFrameRef.current);
|
||||
}
|
||||
if (mobileComposerExpandReleaseFrameRef.current !== null) {
|
||||
window.cancelAnimationFrame(mobileComposerExpandReleaseFrameRef.current);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ describe("expandMobileComposerForKeyboard", () => {
|
||||
|
||||
expandMobileComposerForKeyboard({
|
||||
cancelPendingBlur: vi.fn(() => calls.push("cancel-blur")),
|
||||
cancelPendingExpandFocus: vi.fn(() => calls.push("cancel-expand-focus")),
|
||||
cancelPendingRelease: vi.fn(() => calls.push("cancel-release")),
|
||||
setExpandInFlight: vi.fn((inFlight) => calls.push(`in-flight:${inFlight}`)),
|
||||
commitExpandedState: vi.fn(() => calls.push("commit-expanded")),
|
||||
@@ -17,7 +16,6 @@ describe("expandMobileComposerForKeyboard", () => {
|
||||
|
||||
expect(calls).toEqual([
|
||||
"cancel-blur",
|
||||
"cancel-expand-focus",
|
||||
"cancel-release",
|
||||
"in-flight:true",
|
||||
"commit-expanded",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
export interface MobileComposerExpandOptions {
|
||||
cancelPendingBlur: () => void;
|
||||
cancelPendingExpandFocus: () => void;
|
||||
cancelPendingRelease: () => void;
|
||||
setExpandInFlight: (inFlight: boolean) => void;
|
||||
commitExpandedState: () => void;
|
||||
@@ -10,7 +9,6 @@ export interface MobileComposerExpandOptions {
|
||||
|
||||
export function expandMobileComposerForKeyboard(options: MobileComposerExpandOptions) {
|
||||
options.cancelPendingBlur();
|
||||
options.cancelPendingExpandFocus();
|
||||
options.cancelPendingRelease();
|
||||
options.setExpandInFlight(true);
|
||||
options.commitExpandedState();
|
||||
|
||||
Reference in new issue
Block a user