Skip to content

Commit

Permalink
feat: Re-claim delegations during client setup (#644)
Browse files Browse the repository at this point in the history
The rest of storacha/project-tracking#125.
This along with [generating the space delegations on the fly during
`access/claim`](storacha/w3up#1555) will make
new spaces appear on the page without logging out.

---

If the client is restored from local storage, it may be out of date.
This fetches the latest delegations from the server and updates the
client. This makes loading the client from local storage a
stale-while-revalidate operation.
  • Loading branch information
Peeja authored Oct 7, 2024
1 parent 61d9366 commit 83cc125
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/react/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function useDatamodel ({ servicePrincipal, connection }: DatamodelProps):
setEvents(events)
setAccounts(Object.values(client.accounts()))
setSpaces(client.spaces())
await client.capability.access.claim()
},
[servicePrincipal, connection]
)
Expand Down

0 comments on commit 83cc125

Please sign in to comment.