trotl-filter 1.0.40 → 1.0.41

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/dist/index.cjs.js CHANGED
@@ -9079,6 +9079,12 @@ function DateTimeInput({
9079
9079
  return `${yyyy}-${mm}-${dd}`;
9080
9080
  }, [time]);
9081
9081
 
9082
+ // Stable ref for toInputString to avoid effect re-runs
9083
+ const toInputStringRef = React.useRef(toInputString);
9084
+ React.useEffect(() => {
9085
+ toInputStringRef.current = toInputString;
9086
+ }, [toInputString]);
9087
+
9082
9088
  // Initial value
9083
9089
  const [value, setValue] = React.useState(() => {
9084
9090
  if (typeof controlledValue !== "undefined") return controlledValue;
@@ -9303,7 +9309,7 @@ function DateTimeInput({
9303
9309
  const params = new URLSearchParams(window.location.search);
9304
9310
  const urlVal = params.get(paramKey);
9305
9311
  if (urlVal && urlVal !== lastUrlValueRef.current) {
9306
- const str = toInputString(urlVal);
9312
+ const str = toInputStringRef.current(urlVal);
9307
9313
  setValue(prev => prev !== str ? str : prev);
9308
9314
  if (onChangeRef.current && str !== controlledValueRef.current) onChangeRef.current(urlVal);
9309
9315
  lastUrlValueRef.current = urlVal;
@@ -9336,7 +9342,7 @@ function DateTimeInput({
9336
9342
  window.removeEventListener('pushState', syncFromUrl);
9337
9343
  window.removeEventListener('replaceState', syncFromUrl);
9338
9344
  };
9339
- }, [paramKey, toInputString]);
9345
+ }, [paramKey]);
9340
9346
 
9341
9347
  // Controlled value sync
9342
9348
  React.useEffect(() => {