Skip to content

Commit

Permalink
fix: allow form to reload when offline
Browse files Browse the repository at this point in the history
  • Loading branch information
tomzemp committed Feb 5, 2025
1 parent d6dab34 commit e81bb47
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ describe('ValidationResultsSidebar', () => {
fireEvent.click(getByText('Run validation again'))

await findByText('Running validation...')
await waitForLoaderToDisappear()
expect(queryByText('There was a problem running validation')).toBeNull()
expect(getByText('2 medium priority alerts')).toBeDefined()
})
Expand Down
5 changes: 4 additions & 1 deletion src/data-workspace/data-workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
useValueStore,
dataValueSetQueryKey,
useEntryFormStore,
useConnectionStatus,
} from '../shared/index.js'
import styles from './data-workspace.module.css'
import { EntryForm } from './entry-form.js'
Expand All @@ -30,6 +31,7 @@ export const DataWorkspace = ({ selectionHasNoFormMessage }) => {
useCheckLockStatus()
const updateStore = useValueStore((state) => state.setDataValueSet)
const initialDataValuesFetch = useDataValueSet()
const { offline } = useConnectionStatus()

useEffect(() => {
updateStore(initialDataValuesFetch.data)
Expand Down Expand Up @@ -83,7 +85,8 @@ export const DataWorkspace = ({ selectionHasNoFormMessage }) => {
// or else we might use stale data that won't be updated once request completes
if (
initialDataValuesFetch.isFetching ||
(!initialDataValuesFetch.isFetchedAfterMount &&
(!offline &&
!initialDataValuesFetch.isFetchedAfterMount &&
!initialDataValuesFetch.isPaused)
) {
return (
Expand Down

0 comments on commit e81bb47

Please sign in to comment.