Skip to content

Commit 7e421e7

Browse files
committed
fix(widgets): fact changing on rerender
1 parent 14c9664 commit 7e421e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/widgets/edit/FactsItems.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useMemo } from 'react';
12
import { useTranslation } from 'react-i18next';
23
import { TFactsWidgetOptions } from '../../../store/types/widgets';
34
import { BodySSB, Title } from '../../../styles/text';
@@ -6,7 +7,7 @@ import { EWidgetItemType, TWidgetItem } from './types';
67

78
export const getFactsItems = (options: TFactsWidgetOptions): TWidgetItem[] => {
89
const { t } = useTranslation('widgets');
9-
const fact = getRandomFact();
10+
const fact = useMemo(() => getRandomFact(), []);
1011

1112
return [
1213
{

0 commit comments

Comments
 (0)