Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@
},
"peerDependencies": {
"@comapeo/core": "^7.2.0",
"@comapeo/ipc": "^9.0.0",
"@comapeo/ipc": "^11.0.0",
"@tanstack/react-query": "^5",
"react": "^18 || ^19"
},
"devDependencies": {
"@comapeo/core": "7.5.1",
"@comapeo/ipc": "9.0.1",
"@comapeo/ipc": "11.0.0",
"@eslint/js": "10.0.1",
"@ianvs/prettier-plugin-sort-imports": "4.7.1",
"@mapeo/crypto": "1.1.0",
Expand Down
12 changes: 1 addition & 11 deletions src/hooks/invites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
getInvitesByIdQueryKey,
getInvitesQueryKey,
getMembersQueryKey,
getProjectByIdQueryKey,
getProjectsQueryKey,
} from '../lib/react-query.js'
import { useClientApi } from './client.js'
Expand Down Expand Up @@ -94,19 +93,10 @@ export function useAcceptInvite() {
mutationFn: async ({ inviteId }: { inviteId: string }) => {
return clientApi.invite.accept({ inviteId })
},
onSuccess: (projectId) => {
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: getInvitesQueryKey(),
})
// Accepting an invite (re-)adds the project on the backend, which
// closes any project instance that was open before the invite (e.g.
// after leaving the project) and opens a fresh one. The project
// client is cached with staleTime/gcTime Infinity, so drop it here
// or every observer keeps using the closed instance.
queryClient.removeQueries({
queryKey: getProjectByIdQueryKey({ projectId }),
exact: true,
})
queryClient.invalidateQueries({
queryKey: getProjectsQueryKey(),
})
Expand Down
5 changes: 2 additions & 3 deletions test/hooks/invite-rejoin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,10 @@ test(
)
assert.strictEqual(settingsHook.result.current.data.name, 'mapeo')

// The re-joined project must be a fresh instance — calls on the wrapper
// cached before the re-join reject because that instance is closed.
assert.notStrictEqual(
assert.strictEqual(
rejoinedProjectHook.result.current.data,
originalWrapper,
'Rejoined project uses original project client instance',
)
},
)
Loading