Skip to content

Commit

Permalink
fix: offline record list 🐛 (#1252)
Browse files Browse the repository at this point in the history
## JIRA Ticket

[BSS-508](https://jira.csiro.au/browse/BSS-508)

## Description

Fixed an issue where the record list would not update while offline.

## Proposed Changes

- added property `networkMode: 'always'` so that query will run while
offline
- added property `gcTime: 0` so that query does not using caching

## How to Test

1. Disable your internet
2. Navigate to a survey
3. Create a new record
4. Verify that the new record appears in the record list

## Additional Information

## Checklist

- [x] I have confirmed all commits have been signed.
- [x] I have added JSDoc style comments to any new functions or classes.
- [x] Relevant documentation such as READMEs, guides, and class comments
are updated.
  • Loading branch information
luke-mcfarlane-rocketlab authored Dec 10, 2024
2 parents e54149d + ce81b75 commit 7e50400
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/src/gui/components/notebook/record_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,8 @@ export function RecordsBrowseTable(props: RecordsBrowseTableProps) {
const [query, setQuery] = React.useState('');
const {data: records, isLoading: recordsLoading} = useQuery({
queryKey: ['allrecords', query, props.project_id],
networkMode: 'always',
gcTime: 0,
queryFn: async () => {
if (query.length === 0) {
return await getMetadataForAllRecords(
Expand All @@ -562,10 +564,6 @@ export function RecordsBrowseTable(props: RecordsBrowseTableProps) {
);
}
},
// TODO if we are seeing performance issues, really we should get told when
// to invalidate this cache. To be extra careful to keep records up to date
// we force a refresh on remount
refetchOnMount: true,
});

return (
Expand Down

0 comments on commit 7e50400

Please sign in to comment.