@alpaca-headless/alpaca-headless 1.0.4647 → 1.0.4648

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { LinkField } from "../types/fieldTypes";
3
2
  export declare function ClientLink({ field, children, ...props }: {
4
3
  field: LinkField;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { AlpacaRequestInit } from "./types/fetch";
3
2
  import { RenderingReference } from "./types/layoutDataTypes";
4
3
  import { Rendering } from "./renderings/renderings";
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Rendering } from "./renderings/renderings";
3
2
  import { ApiConfig } from "./services/api";
4
3
  import { ComponentData, Dictionary, Page, RenderingReference, RenderingsMap } from "./types/layoutDataTypes";
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { RenderOptions } from "..";
3
2
  import { ApiConfig } from "../services/api";
4
3
  import { ItemDescriptor } from "../types/items";
@@ -5,7 +5,15 @@ if (!globalThis.alpacaRouteDataCache) {
5
5
  }
6
6
  const fetchRouteData = async ({ path, host, mode, itemId, language, version, options, apiConfig, editRev, siteName, urlSearchParams, }) => {
7
7
  var _a;
8
- if ((mode === "edit" || mode === "preview") && !editRev) {
8
+ // Editing requests must always observe the latest Sitecore value. Parhelia
9
+ // gives every canvas refresh a new edit_rev, so caching edit responses does
10
+ // not provide reuse; it only retains one layout promise per refresh and can
11
+ // replay an older snapshot when the host retries the same revision while a
12
+ // field save is completing.
13
+ //
14
+ // Preview remains cacheable when it has an explicit revision. Without one,
15
+ // preserve the existing fresh-read behavior.
16
+ if (mode === "edit" || (mode === "preview" && !editRev)) {
9
17
  return await doFetchRouteData(path, host, mode, itemId, language, version, options, apiConfig, siteName, urlSearchParams);
10
18
  }
11
19
  const cache = globalThis.alpacaRouteDataCache;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ServerRenderContext } from "../render-context";
3
2
  import { Rendering } from "../renderings/renderings";
4
3
  import { Item, ItemDescriptor, Language, Version } from "./items";
@@ -1,3 +1,2 @@
1
- /// <reference types="node" />
2
1
  import "url";
3
2
  export declare function hashImageUrl(url: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alpaca-headless/alpaca-headless",
3
- "version": "1.0.4647",
3
+ "version": "1.0.4648",
4
4
  "type": "module",
5
5
  "description": "Alpaca Headless",
6
6
  "main": "dist/index.js",
@@ -44,20 +44,18 @@
44
44
  },
45
45
  "homepage": "https://github.com/yourusername/your-module-name#readme",
46
46
  "devDependencies": {
47
- "@types/node": "^20.12.11",
48
- "@types/react": "19.2.2",
49
- "@types/react-dom": "19.2.2",
50
- "@types/uuid": "^10.0.0",
51
- "eslint": "^9.22.0",
47
+ "@types/node": "^25.5.0",
48
+ "@types/react": "19.2.14",
49
+ "eslint": "^9.39.4",
52
50
  "eslint-config-next": "16.2.6",
53
- "typescript": "^5"
51
+ "typescript": "5.9.3"
54
52
  },
55
53
  "dependencies": {
56
54
  "axios": "^1.16.1",
57
55
  "next": "16.2.6",
56
+ "server-only": "^0.0.1",
58
57
  "react": "19.2.4",
59
58
  "react-dom": "19.2.4",
60
- "react-error-boundary": "^4.0.13",
61
- "uuid": "^10.0.0"
59
+ "react-error-boundary": "^6.1.1"
62
60
  }
63
61
  }
@@ -54,7 +54,15 @@ const fetchRouteData = async ({
54
54
  editRev?: string;
55
55
  urlSearchParams?: string;
56
56
  }): Promise<Result> => {
57
- if ((mode === "edit" || mode === "preview") && !editRev) {
57
+ // Editing requests must always observe the latest Sitecore value. Parhelia
58
+ // gives every canvas refresh a new edit_rev, so caching edit responses does
59
+ // not provide reuse; it only retains one layout promise per refresh and can
60
+ // replay an older snapshot when the host retries the same revision while a
61
+ // field save is completing.
62
+ //
63
+ // Preview remains cacheable when it has an explicit revision. Without one,
64
+ // preserve the existing fresh-read behavior.
65
+ if (mode === "edit" || (mode === "preview" && !editRev)) {
58
66
  return await doFetchRouteData(
59
67
  path,
60
68
  host,
package/tsconfig.json CHANGED
@@ -5,6 +5,7 @@
5
5
  "moduleResolution": "bundler",
6
6
  "jsx": "react-jsx",
7
7
  "declaration": true,
8
+ "rootDir": "./src",
8
9
  "outDir": "./dist",
9
10
  "strict": true,
10
11
  "esModuleInterop": true,