File tree Expand file tree Collapse file tree 2 files changed +26
-9
lines changed
api/src/hooks/learningResources
main/src/app/dashboard/my-lists/[id] Expand file tree Collapse file tree 2 files changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,16 @@ const useLearningResourceSetUserListRelationships = () => {
9797 params : LearningResourcesApiLearningResourcesUserlistsPartialUpdateRequest ,
9898 ) => learningResourcesApi . learningResourcesUserlistsPartialUpdate ( params ) ,
9999 onSettled : ( ) => {
100- queryClient . invalidateQueries ( { queryKey : userlistKeys . membershipList ( ) } )
100+ /**
101+ * We need to invalidate:
102+ * - membership check
103+ * - list of user lists (count has changed)
104+ * - userlist detail annd listing for any lists we modified
105+ *
106+ * That's a lot. Let's just invalidate root.
107+ * Additionally, the lists we've removed from the resource are not easily available.
108+ */
109+ queryClient . invalidateQueries ( { queryKey : userlistKeys . root } )
101110 } ,
102111 } )
103112}
@@ -110,9 +119,16 @@ const useLearningResourceSetLearningPathRelationships = () => {
110119 ) =>
111120 learningResourcesApi . learningResourcesLearningPathsPartialUpdate ( params ) ,
112121 onSettled : ( ) => {
113- queryClient . invalidateQueries ( {
114- queryKey : learningPathKeys . membershipList ( ) ,
115- } )
122+ /**
123+ * We need to invalidate:
124+ * - membership check
125+ * - list of user lists (count has changed)
126+ * - userlist detail annd listing for any lists we modified
127+ *
128+ * That's a lot. Let's just invalidate root.
129+ * Additionally, the lists we've removed from the resource are not easily available.
130+ */
131+ queryClient . invalidateQueries ( { queryKey : learningPathKeys . root } )
116132 } ,
117133 } )
118134}
Original file line number Diff line number Diff line change 11import React from "react"
22import { UserListDetailsContent } from "@/app-pages/DashboardPage/UserListDetailsContent"
3- import { PageParams } from "@/app/types"
43import invariant from "tiny-invariant"
4+ import { PageParams } from "@/app/types"
55
6- const Page : React . FC < PageParams < object , { id : number } > > = async ( {
6+ const Page : React . FC < PageParams < never , { id : string } > > = async ( {
77 params,
88} ) => {
9- const resolved = await params
10- invariant ( resolved ?. id , "id is required" )
11- return < UserListDetailsContent userListId = { resolved . id } />
9+ const resolved = await params !
10+ const id = Number ( resolved . id )
11+ invariant ( id , "id is required" )
12+ return < UserListDetailsContent userListId = { id } />
1213}
1314
1415export default Page
You can’t perform that action at this time.
0 commit comments