mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-09 17:36:23 +00:00
fix(betterActivities): avoid conditional hook calls
Prevents crashing when the activities length changes
This commit is contained in:
parent
32476dd1df
commit
57c8f6915c
1 changed files with 3 additions and 2 deletions
|
@ -154,8 +154,6 @@ export default definePlugin({
|
|||
setCurrentActivity(activities[0]);
|
||||
}, [activities]);
|
||||
|
||||
if (!activities.length) return null;
|
||||
|
||||
// we use these for other activities, it would be better to somehow get the corresponding activity props
|
||||
const generalProps = useMemo(() => Object.keys(props).reduce((acc, key) => {
|
||||
// exclude activity specific props to prevent copying them to all activities (e.g. buttons)
|
||||
|
@ -163,6 +161,9 @@ export default definePlugin({
|
|||
return acc;
|
||||
}, {} as Omit<typeof props, "renderActions" | "application">), [props]);
|
||||
|
||||
|
||||
if (!activities.length) return null;
|
||||
|
||||
if (settings.store.allActivitiesStyle === "carousel") {
|
||||
return (
|
||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||
|
|
Loading…
Reference in a new issue