Skip to content

Commit

Permalink
Fix resource viewer race condition with use-data.hook (#598)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyonsil committed Oct 26, 2023
1 parent 23f4498 commit 99b78a7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions extensions/src/resource-viewer/resource-viewer.web-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,15 @@ globalThis.webViewComponent = function ResourceViewer(): JSX.Element {
logger.info('Preparing to display the Resource Viewer');

const [scrRef] = useSetting('platform.verseRef', defaultScrRef);
const [usx, setUsx, isLoading] = useData.ChapterUsx<UsfmProviderDataTypes, 'ChapterUsx'>(
const [usx, setUsx] = useData.ChapterUsx<UsfmProviderDataTypes, 'ChapterUsx'>(
'usfm',
useMemo(() => new VerseRef(scrRef.bookNum, scrRef.chapterNum, scrRef.verseNum), [scrRef]),
'Loading Scripture...',
);

return (
<div>
{isLoading ? (
'Loading'
) : (
<ScriptureTextPanelUsxEditor usx={usx ?? '<usx/>'} onChanged={setUsx} />
)}
<ScriptureTextPanelUsxEditor usx={usx ?? '<usx/>'} onChanged={setUsx} />
</div>
);
};

0 comments on commit 99b78a7

Please sign in to comment.