Skip to content

Commit

Permalink
Experiment: remove session caching
Browse files Browse the repository at this point in the history
This is an experimental build, using an API client that doesn't cache Panoptes user sessions.

- See zooniverse/panoptes-javascript-client#208.
  • Loading branch information
eatyourgreens committed Jun 29, 2023
1 parent d538475 commit bbdcf63
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/app-content-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"next": "~12.3.0",
"next-absolute-url": "~1.2.2",
"next-i18next": "~14.0.0",
"panoptes-client": "~5.3.0",
"panoptes-client": "zooniverse/panoptes-javascript-client#remove-session-caching",
"path-match": "~1.2.4",
"react": "~17.0.2",
"react-dom": "~17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"newrelic": "~10.3.0",
"next": "~12.3.0",
"next-i18next": "~14.0.0",
"panoptes-client": "~5.3.0",
"panoptes-client": "zooniverse/panoptes-javascript-client#remove-session-caching",
"path-match": "~1.2.4",
"polished": "~4.2.2",
"react": "~17.0.2",
Expand Down
5 changes: 4 additions & 1 deletion packages/app-project/src/hooks/usePanoptesUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ const SWRoptions = {

async function fetchPanoptesUser() {
try {
return await auth.checkCurrent()
const user = await auth.checkCurrent()
console.log({ user })
return user
} catch (error) {
console.log(error)
return null
Expand All @@ -20,5 +22,6 @@ async function fetchPanoptesUser() {

export default function usePanoptesUser(key) {
const { data } = useSWR(key, fetchPanoptesUser, SWRoptions)
console.log({ data })
return data
}
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13448,6 +13448,14 @@ pako@~1.0.5:
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf"
integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==

panoptes-client@zooniverse/panoptes-javascript-client#remove-session-caching:
version "5.3.0"
resolved "https://codeload.github.com/zooniverse/panoptes-javascript-client/tar.gz/4c017e4ad8c4acd9966416dcfb7b3c40b1c09114"
dependencies:
local-storage "^2.0.0"
normalizeurl "~1.0.0"
superagent "^8.0.8"

panoptes-client@~5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/panoptes-client/-/panoptes-client-5.3.0.tgz#df3a870de7766d97df6837d87e5660799c5efe2f"
Expand Down

0 comments on commit bbdcf63

Please sign in to comment.