diff --git a/app/soapbox/components/ui/toggle/toggle.tsx b/app/soapbox/components/ui/toggle/toggle.tsx index abf7933c5..1b34dde3c 100644 --- a/app/soapbox/components/ui/toggle/toggle.tsx +++ b/app/soapbox/components/ui/toggle/toggle.tsx @@ -6,7 +6,7 @@ interface IToggle extends Pick, 'id' } /** A glorified checkbox. */ -const Toggle: React.FC = ({ id, size = 'md', name, checked, onChange, required, disabled }) => { +const Toggle: React.FC = ({ id, size = 'md', name, checked = false, onChange, required, disabled }) => { const input = useRef(null); const handleClick: React.MouseEventHandler = () => { diff --git a/app/soapbox/features/hashtag-timeline/index.tsx b/app/soapbox/features/hashtag-timeline/index.tsx index 69cc0cd60..df0c05236 100644 --- a/app/soapbox/features/hashtag-timeline/index.tsx +++ b/app/soapbox/features/hashtag-timeline/index.tsx @@ -41,7 +41,7 @@ export const HashtagTimeline: React.FC = ({ params }) => { useEffect(() => { dispatch(expandHashtagTimeline(id)); dispatch(fetchHashtag(id)); - }, []); + }, [id]); useEffect(() => { dispatch(clearTimeline(`hashtag:${id}`)); diff --git a/app/soapbox/pages/profile-page.tsx b/app/soapbox/pages/profile-page.tsx index b2351e05b..75c4c7ecc 100644 --- a/app/soapbox/pages/profile-page.tsx +++ b/app/soapbox/pages/profile-page.tsx @@ -62,7 +62,7 @@ const ProfilePage: React.FC = ({ params, children }) => { if (account) { const ownAccount = account.id === me; - if (ownAccount || account.pleroma?.hide_favorites !== true) { + if (ownAccount || account.pleroma?.hide_favorites === false) { tabItems.push({ text: , to: `/@${account.acct}/favorites`, diff --git a/app/soapbox/reducers/admin.ts b/app/soapbox/reducers/admin.ts index bf2fd0818..b8b11cd17 100644 --- a/app/soapbox/reducers/admin.ts +++ b/app/soapbox/reducers/admin.ts @@ -145,8 +145,7 @@ const minifyReport = (report: AdminReportRecord): ReducerAdminReport => { target_account: normalizeId(report.getIn(['target_account', 'id'])), action_taken_by_account: normalizeId(report.getIn(['action_taken_by_account', 'id'])), assigned_account: normalizeId(report.getIn(['assigned_account', 'id'])), - - statuses: report.get('statuses').map((status: any) => normalizeId(status.id)), + statuses: report.get('statuses').map((status: any) => normalizeId(status.get('id'))), }) as ReducerAdminReport; }; diff --git a/app/soapbox/reducers/list-adder.ts b/app/soapbox/reducers/list-adder.ts index f2ff96324..81e9bd644 100644 --- a/app/soapbox/reducers/list-adder.ts +++ b/app/soapbox/reducers/list-adder.ts @@ -32,7 +32,7 @@ export default function listAdderReducer(state: State = ReducerRecord(), action: return ReducerRecord(); case LIST_ADDER_SETUP: return state.withMutations(map => { - map.set('accountId', action.account.get('id')); + map.set('accountId', action.account.id); }); case LIST_ADDER_LISTS_FETCH_REQUEST: return state.setIn(['lists', 'isLoading'], true); diff --git a/app/soapbox/utils/normalizers.ts b/app/soapbox/utils/normalizers.ts index 343b1103b..b450a15d8 100644 --- a/app/soapbox/utils/normalizers.ts +++ b/app/soapbox/utils/normalizers.ts @@ -10,7 +10,7 @@ export const makeEmojiMap = (emojis: any) => emojis.reduce((obj: any, emoji: any /** Normalize entity ID */ export const normalizeId = (id: any): string | null => { - return typeof id === 'string' ? id : null; + return z.string().nullable().catch(null).parse(id); }; export type Normalizer = (value: V) => R;