mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
perf(app): reduce redundant data fetching
Share bounded database pools across API repositories, consolidate sync and chat queries, and make mobile refreshes cache-aware and foreground-aware. Add focused regression coverage, client freshness documentation, and repository agent role configuration.
This commit is contained in:
1 parent
9957fa43f2
commit
c7ee8a4851
81 files changed
+4456
-1400
No files matched your search
@@ -47,7 +47,7 @@ const AnimatedSectionList = Animated.createAnimatedComponent(SectionList);
|
||||
type GroupByOption = "pack" | "date" | "answer";
|
||||
|
||||
export default function MyAnswersScreen() {
|
||||
const { responses, isLoading, isLoadingMore, hasMore, groupBy, dateSortOrder, fetchResponses, setGroupBy, toggleDateSortOrder, totalCount } = useResponsesStore();
|
||||
const { responses, isLoading, isRefreshing, isLoadingMore, hasMore, groupBy, dateSortOrder, fetchResponses, ensureResponsesLoaded, setGroupBy, toggleDateSortOrder, totalCount } = useResponsesStore();
|
||||
const { user, partner } = useAuthStore();
|
||||
const router = useRouter();
|
||||
const params = useLocalSearchParams();
|
||||
@@ -110,11 +110,12 @@ export default function MyAnswersScreen() {
|
||||
// Ambient orb breathing animations
|
||||
const { orbStyle1, orbStyle2 } = useAmbientOrbAnimation();
|
||||
|
||||
// Fetch responses on focus
|
||||
// Load once, then keep showing what is cached. Answering or editing a response
|
||||
// invalidates it, and pull-to-refresh is always available.
|
||||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
fetchResponses(true);
|
||||
}, [])
|
||||
void ensureResponsesLoaded();
|
||||
}, [ensureResponsesLoaded])
|
||||
);
|
||||
|
||||
const handleLoadMore = useCallback(() => {
|
||||
@@ -271,7 +272,7 @@ export default function MyAnswersScreen() {
|
||||
scrollEventThrottle={16}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={isLoading}
|
||||
refreshing={isRefreshing}
|
||||
onRefresh={() => fetchResponses(true)}
|
||||
tintColor={colors.primary}
|
||||
colors={[colors.primary]}
|
||||
|
||||
Reference in new issue
Block a user