Skip to content

Commit

Permalink
Fix browser back button behavior in jbrowse-web (#4052)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin authored Nov 8, 2023
1 parent 0c0099b commit aaed7a9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion products/jbrowse-web/src/components/JBrowse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const JBrowse = observer(function ({
const currentSessionId = session.id

useEffect(() => {
setSessionId(`local-${currentSessionId}`)
setSessionId(`local-${currentSessionId}`, 'replaceIn')
// @ts-expect-error
window.JBrowseRootModel = rootModel
// @ts-expect-error
Expand Down
12 changes: 6 additions & 6 deletions products/jbrowse-web/src/components/Loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ export function Loader({
})

useEffect(() => {
setLoc(undefined)
setTracks(undefined)
setAssembly(undefined)
setPassword(undefined)
setSessionTracks(undefined)
setLoc(undefined, 'replaceIn')
setTracks(undefined, 'replaceIn')
setAssembly(undefined, 'replaceIn')
setPassword(undefined, 'replaceIn')
setSessionTracks(undefined, 'replaceIn')
}, [setAssembly, setLoc, setTracks, setPassword, setSessionTracks])

return <Renderer loader={loader} />
Expand Down Expand Up @@ -144,7 +144,7 @@ const Renderer = observer(function ({
}
})

const LoaderWrapper = ({ initialTimestamp }: { initialTimestamp: number }) => {
function LoaderWrapper({ initialTimestamp }: { initialTimestamp: number }) {
return (
<ErrorBoundary
FallbackComponent={props => (
Expand Down
6 changes: 3 additions & 3 deletions products/jbrowse-web/src/components/ShareDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ const ShareDialog = observer(function ({
disabled={currentSetting === 'short' && loading}
onClick={event => {
event.preventDefault()
setPassword(passwordParam)
setSession(sessionParam)
setPassword(passwordParam, 'replaceIn')
setSession(sessionParam, 'replaceIn')
alert('Now press Ctrl+D (PC) or Cmd+D (Mac)')
}}
>
Bookmark
Create browser Bookmark
</Button>

<Button
Expand Down
18 changes: 10 additions & 8 deletions products/jbrowse-web/src/tests/BreakpointSplitView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ test(
'breakpoint split view',
() =>
mockConsoleWarn(async () => {
const { findByTestId, queryAllByTestId } =
const { getByTestId, queryAllByTestId } =
await createView(breakpointConfig)

// the breakpoint could be partially loaded so explicitly wait for two items
await waitFor(() => expect(queryAllByTestId('r1').length).toBe(2), delay)

expect(
await findByTestId('pacbio_hg002_breakpoints-loaded'),
).toMatchSnapshot()

expect(await findByTestId('pacbio_vcf-loaded')).toMatchSnapshot()
await waitFor(() => {
expect(queryAllByTestId('r1').length).toBe(2)
}, delay)
await waitFor(() => {
expect(getByTestId('pacbio_hg002_breakpoints-loaded')).toMatchSnapshot()
}, delay)
await waitFor(() => {
expect(getByTestId('pacbio_vcf-loaded')).toMatchSnapshot()
}, delay)
}),
40000,
)

0 comments on commit aaed7a9

Please sign in to comment.