@terrafirmagreg-team/recipe 1.2.10 → 1.2.12

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@terrafirmagreg-team/recipe",
3
- "version": "1.2.10",
3
+ "version": "1.2.12",
4
4
  "type": "module",
5
5
  "description": "Recipe viewer and calculator",
6
6
  "license": "LGPL-3.0-only",
@@ -24,9 +24,9 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@terrafirmagreg-team/data": "^1.2.3",
27
- "@terrafirmagreg-team/dump": "^1.2.7",
27
+ "@terrafirmagreg-team/dump": "^1.2.9",
28
28
  "@terrafirmagreg-team/game": "^1.2.6",
29
- "@terrafirmagreg-team/kit": "^1.2.12",
29
+ "@terrafirmagreg-team/kit": "^1.2.13",
30
30
  "@terrafirmagreg-team/mdx": "^1.2.7",
31
31
  "@terrafirmagreg-team/preview": "^1.2.3",
32
32
  "@terrafirmagreg-team/sites": "^1.2.2",
@@ -10,6 +10,7 @@ import { recipeCalcHref, recipeHref } from '@terrafirmagreg-team/recipe/lib/link
10
10
  import { parseSectionLocation } from '@terrafirmagreg-team/sites/location';
11
11
  import { Switcher } from '@terrafirmagreg-team/ui/components/blocks/nav/switcher';
12
12
  import { useFailedDatasets } from '@terrafirmagreg-team/kit/hooks/use-dump-status';
13
+ import { useVersionPreference } from '@terrafirmagreg-team/kit/hooks/use-version-pref';
13
14
 
14
15
  export function RecipeAxisSwitcher() {
15
16
  const t = useTranslations();
@@ -18,7 +19,11 @@ export function RecipeAxisSwitcher() {
18
19
  const params = useLocationSearchParams();
19
20
  const axis = recipePlaceFromParams(params).kind;
20
21
  const failed = useFailedDatasets();
21
- const dataset = { id: datasetId ?? '', version: params.get('version') ?? undefined };
22
+ const preferred = useVersionPreference(datasetId);
23
+ const dataset = {
24
+ id: datasetId ?? '',
25
+ version: params.get('version') ?? preferred,
26
+ };
22
27
  if (!datasetId || failed.includes(datasetId)) return null;
23
28
  return (
24
29
  <Switcher
@@ -60,7 +60,13 @@ export const ItemPanelGrid = memo(function ItemPanelGrid({
60
60
  >
61
61
  {shown.map((cell) => (
62
62
  <PanelCell
63
- key={cell.kind === 'recipe' ? `R:${cell.fav.id}` : cell.id}
63
+ key={
64
+ cell.kind === 'recipe'
65
+ ? `R:${cell.fav.id}`
66
+ : cell.kind === 'group'
67
+ ? `G:${cell.id}`
68
+ : cell.id
69
+ }
64
70
  cell={cell}
65
71
  dataset={dataset}
66
72
  lang={lang}
@@ -10,13 +10,16 @@ import { useRecipeModNames } from '@terrafirmagreg-team/recipe/hooks/use-mod-nam
10
10
  import { useSidebarGroup } from '@terrafirmagreg-team/recipe/hooks/use-sidebar-group';
11
11
  import { groupRecipeSidebarByMod } from '@terrafirmagreg-team/recipe/lib/browser/sidebar';
12
12
  import { parseSectionLocation } from '@terrafirmagreg-team/sites/location';
13
+ import { useVersionPreference } from '@terrafirmagreg-team/kit/hooks/use-version-pref';
13
14
 
14
15
  export function useRecipeLeftSidebarTree(tree: PageTree.Root): PageTree.Root {
15
16
  const { dataset: datasetId } = parseSectionLocation(usePathname());
16
17
  const lang = useResolvedLang();
17
18
  const { sidebarGroup } = useSidebarGroup();
18
19
  const scopeKey = datasetId ?? '';
19
- const version = useLocationSearchParams().get('version') ?? undefined;
20
+ const versionParam = useLocationSearchParams().get('version') ?? undefined;
21
+ const preferred = useVersionPreference(datasetId);
22
+ const version = versionParam ?? preferred;
20
23
  const dataset = useMemo(
21
24
  () => (datasetId ? { id: datasetId, version } : undefined),
22
25
  [datasetId, version],
@@ -29,7 +29,7 @@ const registrySliceCache = createDatasetCache(
29
29
  kind: string,
30
30
  ): Promise<Record<string, Record<string, unknown>>> => {
31
31
  const field = registryField(kind);
32
- const raw = await clientDumpJson(dataset, `registry/${field}.json`);
32
+ const raw = await clientDumpJson(dataset, `registry/${field}.json`, 'high');
33
33
  const map = asRecord(raw);
34
34
  return map ? resolveEdgeRows(map) : {};
35
35
  },