Convert disconnectTimeline and timelineDelete actions to Typescript (#30777)

This commit is contained in:
Renaud Chaput 2024-06-20 13:56:52 +02:00 committed by GitHub
parent 27529247b2
commit 1c65932776
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 65 additions and 49 deletions

View file

@ -4,8 +4,7 @@ import {
deployPictureInPictureAction,
removePictureInPicture,
} from 'mastodon/actions/picture_in_picture';
import { TIMELINE_DELETE } from '../actions/timelines';
import { timelineDelete } from 'mastodon/actions/timelines_typed';
export interface PIPMediaProps {
src: string;
@ -49,8 +48,9 @@ export const pictureInPictureReducer: Reducer<PIPState> = (
...action.payload.props,
};
else if (removePictureInPicture.match(action)) return initialState;
else if (action.type === TIMELINE_DELETE)
if (state.type && state.statusId === action.id) return initialState;
else if (timelineDelete.match(action))
if (state.type && state.statusId === action.payload.statusId)
return initialState;
return state;
};