@trackunit/react-components 2.13.25 → 2.13.27-alpha-55a192f4ee4.0

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/index.cjs.js CHANGED
@@ -13105,8 +13105,8 @@ const writeHashKey = (hash, key, value) => {
13105
13105
 
13106
13106
  /**
13107
13107
  * Default maximum length of the resulting URL fragment after adding one
13108
- * persisted entry. Writes are skipped (localStorage continues to hold the
13109
- * full state) when adding the entry would push the fragment past this cap.
13108
+ * persisted entry. Oversized new entries are skipped; oversized replacements
13109
+ * remove the stale entry so localStorage remains authoritative.
13110
13110
  *
13111
13111
  * The fragment is never sent to the server, so it is not subject to the
13112
13112
  * AWS WAF managed-rule `SizeRestrictions_QUERYSTRING` cap that applies to
@@ -13121,8 +13121,8 @@ const MAX_HASH_LENGTH = 64 * 1024;
13121
13121
  *
13122
13122
  * Behaviour mirrors `useSearchParamSync`, with two differences:
13123
13123
  * - Reads from and writes to `location.hash` instead of `location.search`.
13124
- * - Writes are guarded against {@link MAX_HASH_LENGTH} rather than the
13125
- * AWS-WAF-driven search-param cap.
13124
+ * - Oversized replacements remove stale values using
13125
+ * {@link MAX_HASH_LENGTH}, rather than the AWS-WAF-driven search-param cap.
13126
13126
  *
13127
13127
  * The fragment is treated as a sequence of `&`-separated tokens via the
13128
13128
  * pure utilities in `./hashFragment`. Foreign tokens (bare anchors, other
@@ -13204,15 +13204,18 @@ const useHashParamSync = ({ key, enabled = true, onExternalChange, replace: repl
13204
13204
  }
13205
13205
  pendingWriteRef.current = null;
13206
13206
  const { encodedValue, options } = pending;
13207
- const nextHash = writeHashKey(location.hash, key, encodedValue);
13207
+ let nextHash = writeHashKey(location.hash, key, encodedValue);
13208
+ let removedOversizedValue = false;
13208
13209
  if (nextHash.length > MAX_HASH_LENGTH) {
13209
- // Drop the write so the fragment never grows past the cap. The
13210
- // localStorage write performed by `usePersistedState` still holds
13211
- // the full state, so the layout survives a reload on the same
13212
- // browser; only the shareable URL is degraded.
13213
- return;
13210
+ if (currentHashValue === undefined) {
13211
+ return;
13212
+ }
13213
+ nextHash = writeHashKey(location.hash, key, undefined);
13214
+ removedOversizedValue = true;
13214
13215
  }
13215
- const shouldReplace = options?.replace ?? replaceOption ?? !Boolean(currentHashValue);
13216
+ const shouldReplace = removedOversizedValue
13217
+ ? true
13218
+ : (options?.replace ?? replaceOption ?? !Boolean(currentHashValue));
13216
13219
  // Tanstack Router's `navigate({ hash })` expects the fragment body
13217
13220
  // *without* the leading `#` — the router adds the delimiter itself
13218
13221
  // when serialising the URL. Forwarding the `#`-prefixed value from
package/index.esm.js CHANGED
@@ -13104,8 +13104,8 @@ const writeHashKey = (hash, key, value) => {
13104
13104
 
13105
13105
  /**
13106
13106
  * Default maximum length of the resulting URL fragment after adding one
13107
- * persisted entry. Writes are skipped (localStorage continues to hold the
13108
- * full state) when adding the entry would push the fragment past this cap.
13107
+ * persisted entry. Oversized new entries are skipped; oversized replacements
13108
+ * remove the stale entry so localStorage remains authoritative.
13109
13109
  *
13110
13110
  * The fragment is never sent to the server, so it is not subject to the
13111
13111
  * AWS WAF managed-rule `SizeRestrictions_QUERYSTRING` cap that applies to
@@ -13120,8 +13120,8 @@ const MAX_HASH_LENGTH = 64 * 1024;
13120
13120
  *
13121
13121
  * Behaviour mirrors `useSearchParamSync`, with two differences:
13122
13122
  * - Reads from and writes to `location.hash` instead of `location.search`.
13123
- * - Writes are guarded against {@link MAX_HASH_LENGTH} rather than the
13124
- * AWS-WAF-driven search-param cap.
13123
+ * - Oversized replacements remove stale values using
13124
+ * {@link MAX_HASH_LENGTH}, rather than the AWS-WAF-driven search-param cap.
13125
13125
  *
13126
13126
  * The fragment is treated as a sequence of `&`-separated tokens via the
13127
13127
  * pure utilities in `./hashFragment`. Foreign tokens (bare anchors, other
@@ -13203,15 +13203,18 @@ const useHashParamSync = ({ key, enabled = true, onExternalChange, replace: repl
13203
13203
  }
13204
13204
  pendingWriteRef.current = null;
13205
13205
  const { encodedValue, options } = pending;
13206
- const nextHash = writeHashKey(location.hash, key, encodedValue);
13206
+ let nextHash = writeHashKey(location.hash, key, encodedValue);
13207
+ let removedOversizedValue = false;
13207
13208
  if (nextHash.length > MAX_HASH_LENGTH) {
13208
- // Drop the write so the fragment never grows past the cap. The
13209
- // localStorage write performed by `usePersistedState` still holds
13210
- // the full state, so the layout survives a reload on the same
13211
- // browser; only the shareable URL is degraded.
13212
- return;
13209
+ if (currentHashValue === undefined) {
13210
+ return;
13211
+ }
13212
+ nextHash = writeHashKey(location.hash, key, undefined);
13213
+ removedOversizedValue = true;
13213
13214
  }
13214
- const shouldReplace = options?.replace ?? replaceOption ?? !Boolean(currentHashValue);
13215
+ const shouldReplace = removedOversizedValue
13216
+ ? true
13217
+ : (options?.replace ?? replaceOption ?? !Boolean(currentHashValue));
13215
13218
  // Tanstack Router's `navigate({ hash })` expects the fragment body
13216
13219
  // *without* the leading `#` — the router adds the delimiter itself
13217
13220
  // when serialising the URL. Forwarding the `#`-prefixed value from
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "2.13.25",
3
+ "version": "2.13.27-alpha-55a192f4ee4.0",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "migrations": "./migrations.json",
@@ -14,16 +14,16 @@
14
14
  "@floating-ui/react": "^0.26.25",
15
15
  "string-ts": "^2.0.0",
16
16
  "tailwind-merge": "^2.0.0",
17
- "@trackunit/ui-design-tokens": "1.15.34",
18
- "@trackunit/css-class-variance-utilities": "2.0.14",
19
- "@trackunit/shared-utils": "1.16.49",
20
- "@trackunit/ui-icons": "1.14.43",
17
+ "@trackunit/ui-design-tokens": "1.15.35-alpha-55a192f4ee4.0",
18
+ "@trackunit/css-class-variance-utilities": "2.0.15-alpha-55a192f4ee4.0",
19
+ "@trackunit/shared-utils": "1.16.50-alpha-55a192f4ee4.0",
20
+ "@trackunit/ui-icons": "1.14.44-alpha-55a192f4ee4.0",
21
21
  "es-toolkit": "^1.39.10",
22
22
  "@tanstack/react-virtual": "^3.14.3",
23
23
  "dequal": "^2.0.3",
24
24
  "fflate": "^0.8.2",
25
25
  "zod": "^3.25.76",
26
- "@trackunit/i18n-library-translation": "2.4.63"
26
+ "@trackunit/i18n-library-translation": "2.4.65-alpha-55a192f4ee4.0"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": "^19.0.0",
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Default maximum length of the resulting URL fragment after adding one
3
- * persisted entry. Writes are skipped (localStorage continues to hold the
4
- * full state) when adding the entry would push the fragment past this cap.
3
+ * persisted entry. Oversized new entries are skipped; oversized replacements
4
+ * remove the stale entry so localStorage remains authoritative.
5
5
  *
6
6
  * The fragment is never sent to the server, so it is not subject to the
7
7
  * AWS WAF managed-rule `SizeRestrictions_QUERYSTRING` cap that applies to
@@ -37,8 +37,8 @@ type UseHashParamSyncReturn = {
37
37
  *
38
38
  * Behaviour mirrors `useSearchParamSync`, with two differences:
39
39
  * - Reads from and writes to `location.hash` instead of `location.search`.
40
- * - Writes are guarded against {@link MAX_HASH_LENGTH} rather than the
41
- * AWS-WAF-driven search-param cap.
40
+ * - Oversized replacements remove stale values using
41
+ * {@link MAX_HASH_LENGTH}, rather than the AWS-WAF-driven search-param cap.
42
42
  *
43
43
  * The fragment is treated as a sequence of `&`-separated tokens via the
44
44
  * pure utilities in `./hashFragment`. Foreign tokens (bare anchors, other