Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

fix(mobile): bugs fixed

daniel31x13b78aa39f79b2
diff --git a/apps/mobile/app/(tabs)/dashboard/index.tsx b/apps/mobile/app/(tabs)/dashboard/index.tsx
index 5a482579..020d2bfd 100644
--- a/apps/mobile/app/(tabs)/dashboard/index.tsx
+++ b/apps/mobile/app/(tabs)/dashboard/index.tsx
@@ -23,7 +23,7 @@ import { LinkIncludingShortenedCollectionAndTags } from "@linkwarden/types";
import LinkListing from "@/components/LinkListing";
import { useRouter } from "expo-router";
import { rawTheme, ThemeName } from "@/lib/colors";
-import { colorScheme, useColorScheme } from "nativewind";
+import { useColorScheme } from "nativewind";
export default function DashboardScreen() {
const { auth } = useAuthStore();
@@ -33,12 +33,14 @@ export default function DashboardScreen() {
},
...dashboardData
} = useDashboardData(auth);
- const { data: user } = useUser(auth);
+ const { data: user, ...userData } = useUser(auth);
const { data: collections = [] } = useCollections(auth);
const { data: tags = [] } = useTags(auth);
const { colorScheme } = useColorScheme();
+ const router = useRouter();
+
const [dashboardSections, setDashboardSections] = useState<
DashboardSection[]
>(user?.dashboardSections || []);
@@ -90,8 +92,6 @@ export default function DashboardScreen() {
dashboardData,
collectionLinks = [],
}) => {
- const router = useRouter();
-
switch (sectionData.type) {
case DashboardSectionType.STATS:
return (
@@ -349,8 +349,11 @@ export default function DashboardScreen() {
<ScrollView
refreshControl={
<RefreshControl
- refreshing={dashboardData.isLoading}
- onRefresh={dashboardData.refetch}
+ refreshing={dashboardData.isLoading || userData.isLoading}
+ onRefresh={() => {
+ dashboardData.refetch();
+ userData.refetch();
+ }}
/>
}
contentContainerStyle={{
@@ -362,26 +365,24 @@ export default function DashboardScreen() {
contentInsetAdjustmentBehavior="automatic"
>
{orderedSections.map((sectionData) => {
- const collection = collections.find(
- (c) => c.id === sectionData.collectionId
- );
-
return (
<Section
key={sectionData.id}
sectionData={sectionData}
- collection={collection}
+ collection={collections.find(
+ (c) => c.id === sectionData.collectionId
+ )}
+ collectionLinks={
+ sectionData.collectionId
+ ? collectionLinks[sectionData.collectionId]
+ : []
+ }
links={links}
tagsLength={tags.length}
numberOfLinks={numberOfLinks}
collectionsLength={collections.length}
numberOfPinnedLinks={numberOfPinnedLinks}
dashboardData={dashboardData}
- collectionLinks={
- sectionData.collectionId
- ? collectionLinks[sectionData.collectionId]
- : []
- }
/>
);
})}
diff --git a/apps/web/lib/api/controllers/users/userId/getUserById.ts b/apps/web/lib/api/controllers/users/userId/getUserById.ts
index 1ca6ec96..44876bcf 100644
--- a/apps/web/lib/api/controllers/users/userId/getUserById.ts
+++ b/apps/web/lib/api/controllers/users/userId/getUserById.ts
@@ -64,5 +64,7 @@ export default async function getUserById(userId: number) {
},
};
+ console.log("User data fetched successfully:", user.dashboardSections);
+
return { response: data, status: 200 };
}