@terrafirmagreg-team/recipe 1.2.8 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -10
- package/src/components/cards/card/index.tsx +2 -13
- package/src/components/cards/paged-card.tsx +1 -10
- package/src/components/cards/strip-card/index.tsx +1 -3
- package/src/components/views/browser/axis-switcher.tsx +3 -1
- package/src/components/views/browser/index.tsx +52 -22
- package/src/components/views/browser/item-panel/index.tsx +22 -12
- package/src/components/views/browser/item-panel/skeleton.tsx +44 -1
- package/src/components/views/browser/toolbar.tsx +4 -0
- package/src/hooks/use-index.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terrafirmagreg-team/recipe",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Recipe viewer and calculator",
|
|
6
6
|
"license": "LGPL-3.0-only",
|
|
@@ -23,21 +23,22 @@
|
|
|
23
23
|
"./styles.css": "./styles.css"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@terrafirmagreg-team/data": "^1.2.
|
|
27
|
-
"@terrafirmagreg-team/dump": "^1.2.
|
|
28
|
-
"@terrafirmagreg-team/game": "^1.2.
|
|
29
|
-
"@terrafirmagreg-team/kit": "^1.2.
|
|
30
|
-
"@terrafirmagreg-team/mdx": "^1.2.
|
|
26
|
+
"@terrafirmagreg-team/data": "^1.2.3",
|
|
27
|
+
"@terrafirmagreg-team/dump": "^1.2.7",
|
|
28
|
+
"@terrafirmagreg-team/game": "^1.2.6",
|
|
29
|
+
"@terrafirmagreg-team/kit": "^1.2.12",
|
|
30
|
+
"@terrafirmagreg-team/mdx": "^1.2.7",
|
|
31
31
|
"@terrafirmagreg-team/preview": "^1.2.3",
|
|
32
|
-
"@terrafirmagreg-team/sites": "^1.2.
|
|
33
|
-
"@terrafirmagreg-team/translate": "^1.2.
|
|
34
|
-
"@terrafirmagreg-team/ui": "^1.2.
|
|
32
|
+
"@terrafirmagreg-team/sites": "^1.2.2",
|
|
33
|
+
"@terrafirmagreg-team/translate": "^1.2.8",
|
|
34
|
+
"@terrafirmagreg-team/ui": "^1.2.9",
|
|
35
|
+
"@types/pathfinding": "^0.1.0",
|
|
35
36
|
"comlink": "^4.4.2",
|
|
36
37
|
"fflate": "0.8.3",
|
|
37
38
|
"fumadocs-core": "16.17.10",
|
|
38
39
|
"lucide-react": "^1.63.0",
|
|
39
40
|
"pathfinding": "0.4.18",
|
|
40
|
-
"
|
|
41
|
+
"server-only": "^0.0.1"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
44
|
"next": ">=15",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useMemo, useRef
|
|
3
|
+
import { useMemo, useRef } from 'react';
|
|
4
4
|
import { SlotHitbox } from '@terrafirmagreg-team/recipe/components/cards/slot-hitbox';
|
|
5
5
|
import { recipeGlareFilter } from '@terrafirmagreg-team/recipe/components/cards/glare-filter';
|
|
6
6
|
import {
|
|
@@ -21,7 +21,6 @@ import { dumpRelPublicUrl } from '@terrafirmagreg-team/dump/lib/dump/paths';
|
|
|
21
21
|
import { useDumpLocation } from '@terrafirmagreg-team/game/hooks/use-dump-location';
|
|
22
22
|
import type { DatasetRef } from '@terrafirmagreg-team/sites/location';
|
|
23
23
|
import { useInView } from '@terrafirmagreg-team/ui/hooks/use-in-view';
|
|
24
|
-
import { cn } from '@terrafirmagreg-team/ui/lib/utils/cn';
|
|
25
24
|
import { GlbEmbedViewer } from '@terrafirmagreg-team/ui/components/blocks/media/glb/viewer';
|
|
26
25
|
import type { EntryTooltipLevel } from '@terrafirmagreg-team/game/components/entry/tooltip';
|
|
27
26
|
import type {
|
|
@@ -100,19 +99,10 @@ export function RecipeCard({
|
|
|
100
99
|
? dumpRelPublicUrl(dataset, multiblock.glb)
|
|
101
100
|
: undefined;
|
|
102
101
|
|
|
103
|
-
const [imgReady, setImgReady] = useState(false);
|
|
104
|
-
const [prevImgSrc, setPrevImgSrc] = useState(src);
|
|
105
|
-
if (prevImgSrc !== src) {
|
|
106
|
-
setPrevImgSrc(src);
|
|
107
|
-
setImgReady(false);
|
|
108
|
-
}
|
|
109
102
|
return (
|
|
110
103
|
<div
|
|
111
104
|
ref={rootRef}
|
|
112
|
-
className=
|
|
113
|
-
'relative w-fit overflow-hidden rounded-sm',
|
|
114
|
-
imgReady && 'bg-mc-panel',
|
|
115
|
-
)}
|
|
105
|
+
className="relative w-fit overflow-hidden rounded-sm bg-mc-panel"
|
|
116
106
|
>
|
|
117
107
|
{/* eslint-disable-next-line @next/next/no-img-element */}
|
|
118
108
|
<img
|
|
@@ -125,7 +115,6 @@ export function RecipeCard({
|
|
|
125
115
|
decoding="async"
|
|
126
116
|
draggable={false}
|
|
127
117
|
onError={onFail}
|
|
128
|
-
onLoad={() => setImgReady(true)}
|
|
129
118
|
style={recipeGlareFilter}
|
|
130
119
|
/>
|
|
131
120
|
{inView && interactive && glbUrl ? (
|
|
@@ -29,13 +29,6 @@ export function PagedCard({
|
|
|
29
29
|
const inView = props.eager || observedInView;
|
|
30
30
|
const [page, setPage] = useState(0);
|
|
31
31
|
|
|
32
|
-
const [imgReady, setImgReady] = useState(false);
|
|
33
|
-
const [prevSrc, setPrevSrc] = useState(src);
|
|
34
|
-
if (prevSrc !== src) {
|
|
35
|
-
setPrevSrc(src);
|
|
36
|
-
setImgReady(false);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
32
|
const slots = useMemo(() => recipeSlots(recipe), [recipe]);
|
|
40
33
|
const visibleH = maxH ? Math.floor(maxH) : 0;
|
|
41
34
|
const overflow = visibleH > 0 && natural > visibleH;
|
|
@@ -109,8 +102,7 @@ export function PagedCard({
|
|
|
109
102
|
<div
|
|
110
103
|
ref={rootRef}
|
|
111
104
|
className={cn(
|
|
112
|
-
'relative w-fit overflow-hidden rounded-sm',
|
|
113
|
-
imgReady && 'bg-mc-panel',
|
|
105
|
+
'relative w-fit overflow-hidden rounded-sm bg-mc-panel',
|
|
114
106
|
)}
|
|
115
107
|
style={{ height: pinTop + memberH + capH }}
|
|
116
108
|
{...swipe}
|
|
@@ -181,7 +173,6 @@ export function PagedCard({
|
|
|
181
173
|
}}
|
|
182
174
|
loading="lazy"
|
|
183
175
|
decoding="async"
|
|
184
|
-
onLoad={() => setImgReady(true)}
|
|
185
176
|
/>
|
|
186
177
|
</div>
|
|
187
178
|
{pages > 1 && (
|
|
@@ -83,9 +83,7 @@ export function StripCard({
|
|
|
83
83
|
<div
|
|
84
84
|
ref={rootRef}
|
|
85
85
|
className={cn(
|
|
86
|
-
'relative w-fit overflow-hidden rounded-sm',
|
|
87
|
-
|
|
88
|
-
measured?.src === src && 'bg-mc-panel',
|
|
86
|
+
'relative w-fit overflow-hidden rounded-sm bg-mc-panel',
|
|
89
87
|
)}
|
|
90
88
|
style={{
|
|
91
89
|
width: imgW,
|
|
@@ -9,6 +9,7 @@ import { recipePlaceFromParams } from '@terrafirmagreg-team/recipe/lib/links';
|
|
|
9
9
|
import { recipeCalcHref, recipeHref } from '@terrafirmagreg-team/recipe/lib/links';
|
|
10
10
|
import { parseSectionLocation } from '@terrafirmagreg-team/sites/location';
|
|
11
11
|
import { Switcher } from '@terrafirmagreg-team/ui/components/blocks/nav/switcher';
|
|
12
|
+
import { useFailedDatasets } from '@terrafirmagreg-team/kit/hooks/use-dump-status';
|
|
12
13
|
|
|
13
14
|
export function RecipeAxisSwitcher() {
|
|
14
15
|
const t = useTranslations();
|
|
@@ -16,8 +17,9 @@ export function RecipeAxisSwitcher() {
|
|
|
16
17
|
const lang = useResolvedLang();
|
|
17
18
|
const params = useLocationSearchParams();
|
|
18
19
|
const axis = recipePlaceFromParams(params).kind;
|
|
20
|
+
const failed = useFailedDatasets();
|
|
19
21
|
const dataset = { id: datasetId ?? '', version: params.get('version') ?? undefined };
|
|
20
|
-
if (!datasetId) return null;
|
|
22
|
+
if (!datasetId || failed.includes(datasetId)) return null;
|
|
21
23
|
return (
|
|
22
24
|
<Switcher
|
|
23
25
|
options={[
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useDocumentTitle } from '@terrafirmagreg-team/ui/hooks/use-document-title';
|
|
4
|
+
import { useTranslations } from '@terrafirmagreg-team/translate/hooks/use-translations';
|
|
5
|
+
import { useFailedDatasets } from '@terrafirmagreg-team/kit/hooks/use-dump-status';
|
|
6
|
+
import {
|
|
7
|
+
DumpUnavailable,
|
|
8
|
+
DumpUnavailableOverlay,
|
|
9
|
+
} from '@terrafirmagreg-team/kit/components/views/unavailable';
|
|
4
10
|
import { useRecipeSession } from '@terrafirmagreg-team/recipe/hooks/use-session';
|
|
5
11
|
import { recipeConfig } from '@terrafirmagreg-team/recipe/lib/config';
|
|
6
12
|
import { recipeItemName } from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
@@ -13,8 +19,10 @@ import { Calculator } from '@terrafirmagreg-team/recipe/components/views/calc/ca
|
|
|
13
19
|
import { ForgeCalculator } from '@terrafirmagreg-team/recipe/components/views/forge';
|
|
14
20
|
import { AlloyCalculator } from '@terrafirmagreg-team/recipe/components/views/alloy';
|
|
15
21
|
import { RecipeFrame } from '@terrafirmagreg-team/recipe/components/views/browser/frame';
|
|
16
|
-
import {
|
|
17
|
-
|
|
22
|
+
import {
|
|
23
|
+
RecipeHeaderSkeleton,
|
|
24
|
+
RecipeTabsSkeleton,
|
|
25
|
+
} from '@terrafirmagreg-team/recipe/components/views/browser/item-panel/skeleton';
|
|
18
26
|
import { Skeleton } from '@terrafirmagreg-team/ui/components/ui/skeleton';
|
|
19
27
|
import { EntryProvider } from '@terrafirmagreg-team/game/hooks/use-entry-context';
|
|
20
28
|
import { cn } from '@terrafirmagreg-team/ui/lib/utils/cn';
|
|
@@ -26,7 +34,10 @@ export function RecipeBrowserFallback() {
|
|
|
26
34
|
<div className="viewport-shell recipe-viewport not-prose flex w-full flex-col gap-3">
|
|
27
35
|
<div className="flex min-h-0 flex-1 gap-4">
|
|
28
36
|
<main className="flex min-w-0 flex-1 flex-col">
|
|
29
|
-
<
|
|
37
|
+
<RecipeTabsSkeleton />
|
|
38
|
+
<div className="flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-border pb-2 pt-2">
|
|
39
|
+
<RecipeHeaderSkeleton />
|
|
40
|
+
</div>
|
|
30
41
|
<div className="flex min-h-0 flex-1 flex-col items-center justify-start gap-2 pt-2">
|
|
31
42
|
{Array.from({ length: 6 }, (_, i) => (
|
|
32
43
|
<Skeleton
|
|
@@ -59,9 +70,12 @@ export function RecipeBrowser({
|
|
|
59
70
|
lang,
|
|
60
71
|
versions: versions as string[] | undefined,
|
|
61
72
|
};
|
|
73
|
+
const t = useTranslations();
|
|
62
74
|
const session = useRecipeSession(page);
|
|
63
75
|
const { dataset, item, fluid, names } = session;
|
|
64
76
|
const focusId = item ?? fluid;
|
|
77
|
+
const failed =
|
|
78
|
+
useFailedDatasets().includes(id) && !session.index?.items.length;
|
|
65
79
|
|
|
66
80
|
const focusTitle = focusId
|
|
67
81
|
? recipeItemName(names, lang, focusId)
|
|
@@ -70,8 +84,28 @@ export function RecipeBrowser({
|
|
|
70
84
|
|
|
71
85
|
const isCalc = session.place?.kind === 'calc';
|
|
72
86
|
|
|
87
|
+
const frameSkeleton = (
|
|
88
|
+
<RecipeFrame
|
|
89
|
+
session={session}
|
|
90
|
+
strip={<RecipeTabsSkeleton />}
|
|
91
|
+
header={<RecipeHeaderSkeleton />}
|
|
92
|
+
>
|
|
93
|
+
<div className="flex min-h-0 flex-1 flex-col items-center justify-start gap-2 pt-2">
|
|
94
|
+
{Array.from({ length: 6 }, (_, i) => (
|
|
95
|
+
<Skeleton
|
|
96
|
+
key={i}
|
|
97
|
+
className="h-24 rounded-md"
|
|
98
|
+
style={{ width: 240 + (i % 3) * 70 }}
|
|
99
|
+
/>
|
|
100
|
+
))}
|
|
101
|
+
</div>
|
|
102
|
+
</RecipeFrame>
|
|
103
|
+
);
|
|
104
|
+
|
|
73
105
|
let main;
|
|
74
|
-
if (
|
|
106
|
+
if (failed) {
|
|
107
|
+
main = frameSkeleton;
|
|
108
|
+
} else if (focusId) {
|
|
75
109
|
main = <ItemView session={session} />;
|
|
76
110
|
} else if (isCalc) {
|
|
77
111
|
main = <Calculator session={session} />;
|
|
@@ -82,23 +116,7 @@ export function RecipeBrowser({
|
|
|
82
116
|
} else if (session.place?.kind === 'type') {
|
|
83
117
|
main = <TypeView session={session} />;
|
|
84
118
|
} else {
|
|
85
|
-
main =
|
|
86
|
-
<RecipeFrame
|
|
87
|
-
session={session}
|
|
88
|
-
strip={<RecipeTypeTabs session={session} ids={[]} />}
|
|
89
|
-
header={<ItemRow layout="header" title={page.title} />}
|
|
90
|
-
>
|
|
91
|
-
<div className="flex min-h-0 flex-1 flex-col items-center justify-start gap-2 pt-2">
|
|
92
|
-
{Array.from({ length: 6 }, (_, i) => (
|
|
93
|
-
<Skeleton
|
|
94
|
-
key={i}
|
|
95
|
-
className="h-24 rounded-md"
|
|
96
|
-
style={{ width: 240 + (i % 3) * 70 }}
|
|
97
|
-
/>
|
|
98
|
-
))}
|
|
99
|
-
</div>
|
|
100
|
-
</RecipeFrame>
|
|
101
|
-
);
|
|
119
|
+
main = frameSkeleton;
|
|
102
120
|
}
|
|
103
121
|
|
|
104
122
|
return (
|
|
@@ -111,7 +129,19 @@ export function RecipeBrowser({
|
|
|
111
129
|
)}
|
|
112
130
|
>
|
|
113
131
|
<div className="flex min-h-0 flex-1 gap-4">
|
|
114
|
-
<main className="flex min-w-0 flex-1 flex-col">
|
|
132
|
+
<main className="relative flex min-w-0 flex-1 flex-col">
|
|
133
|
+
{main}
|
|
134
|
+
{failed ? (
|
|
135
|
+
<DumpUnavailableOverlay>
|
|
136
|
+
<DumpUnavailable>
|
|
137
|
+
{t(
|
|
138
|
+
'Recipe data is temporarily unavailable. Try again later.',
|
|
139
|
+
{ note: 'recipe.unavailable' },
|
|
140
|
+
)}
|
|
141
|
+
</DumpUnavailable>
|
|
142
|
+
</DumpUnavailableOverlay>
|
|
143
|
+
) : null}
|
|
144
|
+
</main>
|
|
115
145
|
</div>
|
|
116
146
|
<RightSidebarPortal>
|
|
117
147
|
<ItemPanel
|
|
@@ -31,7 +31,11 @@ import { usePanelPage } from '@terrafirmagreg-team/recipe/hooks/use-panel-page';
|
|
|
31
31
|
import { useItemPress } from '@terrafirmagreg-team/recipe/hooks/use-item-press';
|
|
32
32
|
import { usePanelCells } from '@terrafirmagreg-team/recipe/hooks/use-panel-cells';
|
|
33
33
|
import { usePanelTabs } from '@terrafirmagreg-team/recipe/hooks/use-panel-tabs';
|
|
34
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
RecipePanelSkeleton,
|
|
36
|
+
RecipeTabsSkeleton,
|
|
37
|
+
} from '@terrafirmagreg-team/recipe/components/views/browser/item-panel/skeleton';
|
|
38
|
+
import { useFailedDatasets } from '@terrafirmagreg-team/kit/hooks/use-dump-status';
|
|
35
39
|
import { cn } from '@terrafirmagreg-team/ui/lib/utils/cn';
|
|
36
40
|
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
37
41
|
import type {
|
|
@@ -133,12 +137,14 @@ export const ItemPanel = memo(function ItemPanel({
|
|
|
133
137
|
|
|
134
138
|
const tabOptions = usePanelTabs(dIndex, dNames, dLang);
|
|
135
139
|
|
|
140
|
+
const failed = useFailedDatasets().includes(dataset.id);
|
|
141
|
+
|
|
136
142
|
let body;
|
|
137
143
|
const indexEmpty = !index?.items.length;
|
|
138
|
-
if (!measured || (indexLoading && indexEmpty)) {
|
|
144
|
+
if (!measured || ((indexLoading || failed) && indexEmpty)) {
|
|
139
145
|
body =
|
|
140
|
-
indexLoading && indexEmpty ? (
|
|
141
|
-
<
|
|
146
|
+
(indexLoading || failed) && indexEmpty ? (
|
|
147
|
+
<RecipePanelSkeleton cols={cols} rows={rows} />
|
|
142
148
|
) : null;
|
|
143
149
|
} else if (!list.shown.length) {
|
|
144
150
|
body = (
|
|
@@ -174,14 +180,18 @@ export const ItemPanel = memo(function ItemPanel({
|
|
|
174
180
|
|
|
175
181
|
return (
|
|
176
182
|
<div className={cn('not-prose flex min-h-0 flex-col gap-2', className)}>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
{(indexLoading || failed) && indexEmpty ? (
|
|
184
|
+
<RecipeTabsSkeleton />
|
|
185
|
+
) : (
|
|
186
|
+
<IconPager
|
|
187
|
+
value={mode === 'fav' ? 'fav' : (tab ?? '')}
|
|
188
|
+
options={tabOptions}
|
|
189
|
+
onChange={(id) => {
|
|
190
|
+
setMode('all');
|
|
191
|
+
setTab(id);
|
|
192
|
+
}}
|
|
193
|
+
/>
|
|
194
|
+
)}
|
|
185
195
|
<Pager
|
|
186
196
|
page={list.page}
|
|
187
197
|
pages={list.pages}
|
|
@@ -1,8 +1,51 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { PagerArrow } from '@terrafirmagreg-team/ui/components/blocks/page/pager';
|
|
3
4
|
import { Skeleton } from '@terrafirmagreg-team/ui/components/ui/skeleton';
|
|
5
|
+
import { cn } from '@terrafirmagreg-team/ui/lib/utils/cn';
|
|
4
6
|
|
|
5
|
-
export function
|
|
7
|
+
export function RecipeTabsSkeleton({
|
|
8
|
+
count = 9,
|
|
9
|
+
className,
|
|
10
|
+
}: {
|
|
11
|
+
count?: number;
|
|
12
|
+
className?: string;
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<div
|
|
16
|
+
aria-hidden
|
|
17
|
+
className={cn('flex min-h-9 items-center gap-1', className)}
|
|
18
|
+
>
|
|
19
|
+
<PagerArrow dir={-1} disabled onClick={() => {}} />
|
|
20
|
+
<div className="flex min-w-0 flex-1 items-center justify-center gap-1">
|
|
21
|
+
{Array.from({ length: count }, (_, i) => (
|
|
22
|
+
<Skeleton key={i} className="size-9 shrink-0 rounded-sm" />
|
|
23
|
+
))}
|
|
24
|
+
</div>
|
|
25
|
+
<PagerArrow dir={1} disabled onClick={() => {}} />
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function RecipeHeaderSkeleton() {
|
|
31
|
+
return (
|
|
32
|
+
<div aria-hidden className="flex items-start gap-3">
|
|
33
|
+
<Skeleton className="size-8 shrink-0 rounded-md" />
|
|
34
|
+
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
35
|
+
<Skeleton className="h-3 w-20 rounded-sm" />
|
|
36
|
+
<Skeleton className="h-4 w-40 rounded-sm" />
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function RecipePanelSkeleton({
|
|
43
|
+
cols,
|
|
44
|
+
rows,
|
|
45
|
+
}: {
|
|
46
|
+
cols: number;
|
|
47
|
+
rows: number;
|
|
48
|
+
}) {
|
|
6
49
|
return (
|
|
7
50
|
<ul
|
|
8
51
|
aria-hidden
|
|
@@ -11,11 +11,15 @@ import {
|
|
|
11
11
|
SheetTitle,
|
|
12
12
|
} from '@terrafirmagreg-team/ui/components/ui/sheet';
|
|
13
13
|
import { ItemPanel } from '@terrafirmagreg-team/recipe/components/views/browser/item-panel';
|
|
14
|
+
import { useFailedDatasets } from '@terrafirmagreg-team/kit/hooks/use-dump-status';
|
|
14
15
|
import type { RecipeSession } from '@terrafirmagreg-team/recipe/types';
|
|
15
16
|
|
|
16
17
|
export function RecipeToolbar({ session }: { session: RecipeSession }) {
|
|
17
18
|
const t = useTranslations();
|
|
18
19
|
const [itemsOpen, setItemsOpen] = useState(false);
|
|
20
|
+
const failed = useFailedDatasets().includes(session.dataset.id);
|
|
21
|
+
if ((session.indexLoading || failed) && !session.index?.items.length)
|
|
22
|
+
return null;
|
|
19
23
|
|
|
20
24
|
return (
|
|
21
25
|
<div className="flex items-center gap-2">
|
package/src/hooks/use-index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { DatasetRef } from '@terrafirmagreg-team/sites/location';
|
|
|
4
4
|
import { startTransition, useMemo, useState } from 'react';
|
|
5
5
|
import { useLang } from '@terrafirmagreg-team/translate/provider';
|
|
6
6
|
import { useAsyncEffect } from '@terrafirmagreg-team/ui/hooks/use-async-value';
|
|
7
|
+
import { useDumpRetryNonce } from '@terrafirmagreg-team/kit/hooks/use-dump-status';
|
|
7
8
|
import {
|
|
8
9
|
loadRecipeChromeClient,
|
|
9
10
|
loadRecipeCompactIndex,
|
|
@@ -28,6 +29,7 @@ export function useRecipeIndex(dataset: DatasetRef | undefined, lang: string) {
|
|
|
28
29
|
const [loaded, setLoaded] = useState<LoadedIndex | null>(null);
|
|
29
30
|
const [complete, setComplete] = useState<string | null>(null);
|
|
30
31
|
const [lastFull, setLastFull] = useState<RecipeCompactIndex | null>(null);
|
|
32
|
+
const nonce = useDumpRetryNonce();
|
|
31
33
|
const { locales: items } = useLang();
|
|
32
34
|
const locales = useMemo(
|
|
33
35
|
() => items?.map((item) => item.locale) ?? [lang],
|
|
@@ -50,7 +52,7 @@ export function useRecipeIndex(dataset: DatasetRef | undefined, lang: string) {
|
|
|
50
52
|
setLastFull(index);
|
|
51
53
|
});
|
|
52
54
|
publishRecipeIndex(dataset, lang, index);
|
|
53
|
-
}, [dataset, lang]);
|
|
55
|
+
}, [dataset, lang, nonce]);
|
|
54
56
|
|
|
55
57
|
useAsyncEffect(async (isCancelled) => {
|
|
56
58
|
if (!dataset) return;
|