Update usages of refs for React 19 compatibility (#29536)

* Update usages of refs for React 19 compatibility

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Simplify

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-03-28 10:07:41 +00:00
committed by GitHub
parent d7730f417b
commit fac982811c
75 changed files with 378 additions and 133 deletions

View File

@@ -65,7 +65,9 @@ describe("FilePanel", () => {
roomId={room.roomId}
onClose={jest.fn()}
resizeNotifier={new ResizeNotifier()}
ref={(ref) => (filePanel = ref)}
ref={(ref) => {
filePanel = ref;
}}
/>,
);
await screen.findByText("No files visible in this room");

View File

@@ -128,7 +128,7 @@ describe("RoomView", () => {
cleanup();
});
const mountRoomView = async (ref?: RefObject<RoomView>): Promise<RenderResult> => {
const mountRoomView = async (ref?: RefObject<RoomView | null>): Promise<RenderResult> => {
if (stores.roomViewStore.getRoomId() !== room.roomId) {
const switchedRoom = new Promise<void>((resolve) => {
const subFn = () => {

View File

@@ -211,7 +211,9 @@ describe("TimelinePanel", () => {
timelineSet={timelineSet}
manageReadMarkers={true}
manageReadReceipts={true}
ref={(ref) => (timelinePanel = ref)}
ref={(ref) => {
timelinePanel = ref;
}}
/>,
withClientContextRenderOptions(MatrixClientPeg.safeGet()),
);

View File

@@ -18,7 +18,7 @@ describe("SeekBar", () => {
let playback: Playback;
let renderResult: RenderResult;
let frameRequestCallback: FrameRequestCallback;
let seekBarRef: RefObject<SeekBar>;
let seekBarRef: RefObject<SeekBar | null>;
beforeEach(() => {
seekBarRef = createRef();

View File

@@ -34,7 +34,7 @@ jest.mock("../../../../../src/stores/VoiceRecordingStore", () => ({
}));
describe("<VoiceRecordComposerTile/>", () => {
let voiceRecordComposerTile: RefObject<VoiceRecordComposerTile>;
let voiceRecordComposerTile: RefObject<VoiceRecordComposerTile | null>;
let mockRecorder: VoiceMessageRecording;
let mockUpload: IUpload;
let mockClient: MatrixClient;