Skip to content

Commit

Permalink
Avoid clearing hubURL
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jan 22, 2025
1 parent bf3ffa0 commit 14c1917
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 6 additions & 3 deletions products/jbrowse-web/src/SessionLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,13 +536,16 @@ const SessionLoader = types
this.decodeJb1StyleSession()
} else if (isEncodedSession) {
await this.decodeEncodedUrlSession()
} else if (isHubSession) {
this.decodeHubSpec()
self.setBlankSession(true)
} else if (isJsonSession) {
await this.decodeJsonUrlSession()
} else if (isLocalSession) {
await this.fetchSessionStorageSession()
} else if (isHubSession) {
// this is later in the list: prioritiz local session of "hub
// spec" since hub is left in URL even when there may be a
// local session
this.decodeHubSpec()
self.setBlankSession(true)
} else if (sessionQuery) {
// if there was a sessionQuery and we don't recognize it
throw new Error('unrecognized session format')
Expand Down
7 changes: 4 additions & 3 deletions products/jbrowse-web/src/components/Loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function Loader({
const [password, setPassword] = useQueryParam('password', Str)
const [loc, setLoc] = useQueryParam('loc', Str)
const [sessionTracks, setSessionTracks] = useQueryParam('sessionTracks', Str)
const [hubURL, setHubURL] = useQueryParam('hubURL', Str)
const [hubURL] = useQueryParam('hubURL', Str)
const [assembly, setAssembly] = useQueryParam('assembly', Str)
const [tracks, setTracks] = useQueryParam('tracks', Str)
const [highlight, setHighlight] = useQueryParam('highlight', Str)
Expand All @@ -68,10 +68,12 @@ export function Loader({
initialTimestamp,
})

// hubURL is specifically, for now, not cleared because otherwise it does not
// survive a refresh very well since it takes a different path from normal
// config loading
useEffect(() => {
setLoc(undefined, 'replaceIn')
setTracks(undefined, 'replaceIn')
setHubURL(undefined, 'replaceIn')
setAssembly(undefined, 'replaceIn')
setPassword(undefined, 'replaceIn')
setSessionTracks(undefined, 'replaceIn')
Expand All @@ -81,7 +83,6 @@ export function Loader({
}, [
setAssembly,
setHighlight,
setHubURL,
setLoc,
setNav,
setPassword,
Expand Down

0 comments on commit 14c1917

Please sign in to comment.