From 988bbc107b7e20a49f2bbb34d271426b51f4f9ef Mon Sep 17 00:00:00 2001 From: FoolRunning Date: Wed, 28 Jun 2023 11:21:22 -0400 Subject: [PATCH] Fixed constant redraws caused by reference comparison instead of value comparison --- extensions/lib/hello-world/hello-world.web-view.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/lib/hello-world/hello-world.web-view.tsx b/extensions/lib/hello-world/hello-world.web-view.tsx index 92361e3058..c0dda48e7f 100644 --- a/extensions/lib/hello-world/hello-world.web-view.tsx +++ b/extensions/lib/hello-world/hello-world.web-view.tsx @@ -12,9 +12,9 @@ import { } from 'papi-components'; import { QuickVerseDataTypes } from '@extensions/quick-verse/quick-verse'; import { PeopleDataProvider, PeopleDataTypes } from '@extensions/hello-someone/hello-someone'; -import { type UsfmProviderDataTypes } from '@extensions/external-usfm-data-provider'; +import type { UsfmProviderDataTypes } from '@extensions/external-usfm-data-provider'; import type { DataProviderDataType } from 'shared/models/data-provider.model'; -import { Key, useCallback, useContext, useState } from 'react'; +import { Key, useCallback, useContext, useMemo, useState } from 'react'; type Row = { id: string; @@ -97,13 +97,13 @@ globalThis.webViewComponent = function HelloWorld() { const [psalm1] = useData.Chapter( 'usfm', - { book: 'PSA', chapter: '1', verse: '1', versification: 'English' }, + useMemo(() => ({ book: 'PSA', chapter: '1', verse: '1', versification: 'English' }), []), 'Loading Psalm 1...', ); const [john11] = useData.Verse( 'usfm', - { verseString: 'JHN 1:1' }, + useMemo(() => ({ verseString: 'JHN 1:1' }), []), 'Loading John 1:1...', );