Skip to content

Commit 7fd167e

Browse files
refactor(mobile): thread settings builds its catalog in a plain function
useThreadSettingsCatalogItems called no hooks once its useMemo was gone, so the compiler skipped it and rebuilt the catalog every render. As a plain function called after the component's hooks, the call is cached on the settings session. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 7829cf4 commit 7fd167e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎apps/mobile/src/features/threads/ThreadSettingsSheet.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ function ThreadSettingsProviderListHeader(props: {
671671
);
672672
}
673673

674-
function useThreadSettingsCatalogItems(
674+
function buildThreadSettingsCatalogItems(
675675
session: ThreadSettingsSessionValue,
676676
): ReadonlyArray<ThreadSettingsCatalogItem> {
677677
return session.providerGroups.flatMap((group) => {
@@ -872,8 +872,8 @@ function ThreadSettingsMainContent(props: {
872872
if (error) Dialog.alert("Could not refresh models", error);
873873
});
874874
};
875-
const catalogItems = useThreadSettingsCatalogItems(session);
876875
const [animationsReady, setAnimationsReady] = useState(false);
876+
const catalogItems = buildThreadSettingsCatalogItems(session);
877877
const hasActiveCatalogFilter =
878878
session.providerFilter !== null || session.searchQuery.trim().length > 0;
879879
const listItems = [

0 commit comments

Comments
 (0)