@inertiajs/react 3.0.0-beta.3 → 3.0.0-beta.4

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.js CHANGED
@@ -8,7 +8,14 @@ import {
8
8
  normalizeLayouts,
9
9
  router
10
10
  } from "@inertiajs/core";
11
- import { createElement, useEffect, useMemo as useMemo2, useState } from "react";
11
+ import {
12
+ createElement,
13
+ isValidElement,
14
+ useEffect,
15
+ useMemo,
16
+ useState,
17
+ useSyncExternalStore
18
+ } from "react";
12
19
  import { flushSync } from "react-dom";
13
20
 
14
21
  // src/HeadContext.ts
@@ -18,8 +25,7 @@ headContext.displayName = "InertiaHeadContext";
18
25
  var HeadContext_default = headContext;
19
26
 
20
27
  // src/layoutProps.ts
21
- import { createLayoutPropsStore, mergeLayoutProps } from "@inertiajs/core";
22
- import { createContext as createContext2, useContext, useMemo, useSyncExternalStore } from "react";
28
+ import { createLayoutPropsStore } from "@inertiajs/core";
23
29
  var store = createLayoutPropsStore();
24
30
  function setLayoutProps(props) {
25
31
  store.set(props);
@@ -30,21 +36,10 @@ function setLayoutPropsFor(name, props) {
30
36
  function resetLayoutProps() {
31
37
  store.reset();
32
38
  }
33
- var LayoutPropsContext = createContext2({
34
- staticProps: {}
35
- });
36
- function useLayoutProps(defaults) {
37
- const { staticProps, name } = useContext(LayoutPropsContext);
38
- const { shared, named } = useSyncExternalStore(store.subscribe, store.get, store.get);
39
- return useMemo(() => {
40
- const dynamicProps = name ? { ...shared, ...named[name] } : shared;
41
- return mergeLayoutProps(defaults, staticProps, dynamicProps);
42
- }, [defaults, staticProps, name, shared, named]);
43
- }
44
39
 
45
40
  // src/PageContext.ts
46
- import { createContext as createContext3 } from "react";
47
- var pageContext = createContext3(null);
41
+ import { createContext as createContext2 } from "react";
42
+ var pageContext = createContext2(null);
48
43
  pageContext.displayName = "InertiaPageContext";
49
44
  var PageContext_default = pageContext;
50
45
 
@@ -74,6 +69,10 @@ var routerIsInitialized = false;
74
69
  var swapComponent = async () => {
75
70
  currentIsInitialPage = false;
76
71
  };
72
+ var emptySnapshot = {
73
+ shared: {},
74
+ named: {}
75
+ };
77
76
  function App({
78
77
  children,
79
78
  initialPage,
@@ -88,7 +87,7 @@ function App({
88
87
  page: { ...initialPage, flash: initialPage.flash ?? {} },
89
88
  key: null
90
89
  });
91
- const headManager = useMemo2(() => {
90
+ const headManager = useMemo(() => {
92
91
  return createHeadManager(
93
92
  typeof window === "undefined",
94
93
  titleCallback || ((title) => title),
@@ -96,6 +95,7 @@ function App({
96
95
  })
97
96
  );
98
97
  }, []);
98
+ const dynamicLayoutProps = useSyncExternalStore(store.subscribe, store.get, () => emptySnapshot);
99
99
  if (!routerIsInitialized) {
100
100
  router.init({
101
101
  initialPage,
@@ -139,16 +139,40 @@ function App({
139
139
  const renderChildren = children || (({ Component, props, key }) => {
140
140
  const child = createElement(Component, { key, ...props });
141
141
  if (Component.layout && isRenderFunction(Component.layout)) {
142
- return Component.layout(child);
142
+ const result = Component.layout(props);
143
+ if (isValidElement(result)) {
144
+ return Component.layout(child);
145
+ }
146
+ const layouts2 = normalizeLayouts(result, isComponent);
147
+ if (layouts2.length > 0) {
148
+ return layouts2.reduceRight((childNode, layout) => {
149
+ return createElement(
150
+ layout.component,
151
+ {
152
+ ...props,
153
+ ...layout.props,
154
+ ...dynamicLayoutProps.shared,
155
+ ...layout.name ? dynamicLayoutProps.named[layout.name] || {} : {}
156
+ },
157
+ childNode
158
+ );
159
+ }, child);
160
+ }
161
+ return child;
143
162
  }
144
163
  const effectiveLayout = Component.layout ?? defaultLayout?.(current.page.component, current.page);
145
164
  const layouts = normalizeLayouts(effectiveLayout, isComponent, Component.layout ? isRenderFunction : void 0);
146
165
  if (layouts.length > 0) {
147
166
  return layouts.reduceRight((childNode, layout) => {
148
167
  return createElement(
149
- LayoutPropsContext.Provider,
150
- { value: { staticProps: { ...props, ...layout.props }, name: layout.name } },
151
- createElement(layout.component, { ...props, ...layout.props }, childNode)
168
+ layout.component,
169
+ {
170
+ ...props,
171
+ ...layout.props,
172
+ ...dynamicLayoutProps.shared,
173
+ ...layout.name ? dynamicLayoutProps.named[layout.name] || {} : {}
174
+ },
175
+ childNode
152
176
  );
153
177
  }, child);
154
178
  }
@@ -287,8 +311,8 @@ async function createInertiaApp({
287
311
 
288
312
  // src/Deferred.ts
289
313
  import { isSameUrlWithoutQueryOrHash } from "@inertiajs/core";
290
- import { get } from "lodash-es";
291
- import { useEffect as useEffect2, useMemo as useMemo3, useRef, useState as useState2 } from "react";
314
+ import { get } from "es-toolkit/compat";
315
+ import { useEffect as useEffect2, useMemo as useMemo2, useRef, useState as useState2 } from "react";
292
316
 
293
317
  // src/usePage.ts
294
318
  import { use } from "react";
@@ -318,7 +342,7 @@ var Deferred = ({ children, data, fallback }) => {
318
342
  const [reloading, setReloading] = useState2(false);
319
343
  const activeReloads = useRef(/* @__PURE__ */ new Set());
320
344
  const pageProps = usePage().props;
321
- const keys = useMemo3(() => Array.isArray(data) ? data : [data], [data]);
345
+ const keys = useMemo2(() => Array.isArray(data) ? data : [data], [data]);
322
346
  useEffect2(() => {
323
347
  const removeStartListener = router3.on("start", (e) => {
324
348
  const visit = e.detail.visit;
@@ -343,7 +367,7 @@ var Deferred = ({ children, data, fallback }) => {
343
367
  useEffect2(() => {
344
368
  setLoaded(keys.every((key) => get(pageProps, key) !== void 0));
345
369
  }, [pageProps, keys]);
346
- const propsAreDefined = useMemo3(() => keys.every((key) => get(pageProps, key) !== void 0), [keys, pageProps]);
370
+ const propsAreDefined = useMemo2(() => keys.every((key) => get(pageProps, key) !== void 0), [keys, pageProps]);
347
371
  if (loaded && propsAreDefined) {
348
372
  if (typeof children === "function") {
349
373
  return children({ reloading });
@@ -366,15 +390,15 @@ import {
366
390
  resolveUrlMethodPairComponent,
367
391
  UseFormUtils as UseFormUtils3
368
392
  } from "@inertiajs/core";
369
- import { isEqual as isEqual2 } from "lodash-es";
393
+ import { isEqual as isEqual2 } from "es-toolkit";
370
394
  import React, {
371
- createContext as createContext4,
395
+ createContext as createContext3,
372
396
  createElement as createElement3,
373
397
  forwardRef,
374
398
  use as use2,
375
399
  useEffect as useEffect6,
376
400
  useImperativeHandle,
377
- useMemo as useMemo5,
401
+ useMemo as useMemo4,
378
402
  useRef as useRef4,
379
403
  useState as useState6
380
404
  } from "react";
@@ -384,7 +408,7 @@ import {
384
408
  router as router5,
385
409
  UseFormUtils as UseFormUtils2
386
410
  } from "@inertiajs/core";
387
- import { cloneDeep as cloneDeep2 } from "lodash-es";
411
+ import { cloneDeep as cloneDeep2 } from "es-toolkit";
388
412
  import { useCallback as useCallback2, useRef as useRef3, useState as useState5 } from "react";
389
413
 
390
414
  // src/react.ts
@@ -397,13 +421,14 @@ function useIsomorphicLayoutEffect(effect, deps) {
397
421
  import {
398
422
  UseFormUtils
399
423
  } from "@inertiajs/core";
424
+ import { cloneDeep, isEqual } from "es-toolkit";
425
+ import { get as get2, has, set } from "es-toolkit/compat";
400
426
  import {
401
427
  createValidator,
402
428
  resolveName,
403
429
  toSimpleValidationErrors
404
430
  } from "laravel-precognition";
405
- import { cloneDeep, get as get2, has, isEqual, set } from "lodash-es";
406
- import { useCallback, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef2, useState as useState3 } from "react";
431
+ import { useCallback, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef2, useState as useState3 } from "react";
407
432
  function useFormState(options) {
408
433
  const { data: dataOption, useDataState, useErrorsState } = options;
409
434
  const isDataFunction = typeof dataOption === "function";
@@ -414,14 +439,12 @@ function useFormState(options) {
414
439
  const [defaults, setDefaultsState] = useState3(cloneDeep(initialData));
415
440
  const [data, setData] = useDataState ? useDataState() : useState3(cloneDeep(initialData));
416
441
  const [errors, setErrors] = useErrorsState ? useErrorsState() : useState3({});
417
- const [hasErrors, setHasErrors] = useState3(false);
418
- const [processing, setProcessing] = useState3(false);
419
- const [progress2, setProgress] = useState3(null);
442
+ const [processing, _setProcessing] = useState3(false);
443
+ const [progress2, _setProgress] = useState3(null);
420
444
  const [wasSuccessful, setWasSuccessful] = useState3(false);
421
445
  const [recentlySuccessful, setRecentlySuccessful] = useState3(false);
422
446
  const recentlySuccessfulTimeoutId = useRef2(void 0);
423
447
  const transformRef = useRef2((data2) => data2);
424
- const isDirty = useMemo4(() => !isEqual(data, defaults), [data, defaults]);
425
448
  const defaultsCalledInOnSuccessRef = useRef2(false);
426
449
  const validatorRef = useRef2(null);
427
450
  const [validating, setValidating] = useState3(false);
@@ -439,6 +462,38 @@ function useFormState(options) {
439
462
  isMounted.current = false;
440
463
  };
441
464
  }, []);
465
+ const snapshotRef = useRef2({
466
+ data,
467
+ defaults,
468
+ errors,
469
+ processing,
470
+ progress: progress2,
471
+ wasSuccessful,
472
+ recentlySuccessful,
473
+ validating,
474
+ touchedFields,
475
+ validFields
476
+ });
477
+ snapshotRef.current = {
478
+ data,
479
+ defaults,
480
+ errors,
481
+ processing,
482
+ progress: progress2,
483
+ wasSuccessful,
484
+ recentlySuccessful,
485
+ validating,
486
+ touchedFields,
487
+ validFields
488
+ };
489
+ const setProcessing = useCallback((value) => {
490
+ _setProcessing(value);
491
+ snapshotRef.current.processing = value;
492
+ }, []);
493
+ const setProgress = useCallback((value) => {
494
+ _setProgress(value);
495
+ snapshotRef.current.progress = value;
496
+ }, []);
442
497
  const setDataFunction = useCallback(
443
498
  (keyOrData, maybeValue) => {
444
499
  if (typeof keyOrData === "string") {
@@ -510,12 +565,12 @@ function useFormState(options) {
510
565
  ...errors2,
511
566
  ...typeof fieldOrFields === "string" ? { [fieldOrFields]: maybeValue } : fieldOrFields
512
567
  };
513
- setHasErrors(Object.keys(newErrors).length > 0);
568
+ snapshotRef.current.errors = newErrors;
514
569
  validatorRef.current?.setErrors(newErrors);
515
570
  return newErrors;
516
571
  });
517
572
  },
518
- [setErrors, setHasErrors]
573
+ [setErrors]
519
574
  );
520
575
  const clearErrors = useCallback(
521
576
  (...fields) => {
@@ -527,7 +582,7 @@ function useFormState(options) {
527
582
  }),
528
583
  {}
529
584
  );
530
- setHasErrors(Object.keys(newErrors).length > 0);
585
+ snapshotRef.current.errors = newErrors;
531
586
  if (validatorRef.current) {
532
587
  if (fields.length === 0) {
533
588
  validatorRef.current.setErrors({});
@@ -538,7 +593,7 @@ function useFormState(options) {
538
593
  return newErrors;
539
594
  });
540
595
  },
541
- [setErrors, setHasErrors]
596
+ [setErrors]
542
597
  );
543
598
  const resetAndClearErrors = useCallback(
544
599
  (...fields) => {
@@ -547,21 +602,29 @@ function useFormState(options) {
547
602
  },
548
603
  [reset, clearErrors]
549
604
  );
605
+ const setWasSuccessfulWithSnapshot = useCallback((value) => {
606
+ setWasSuccessful(value);
607
+ snapshotRef.current.wasSuccessful = value;
608
+ }, []);
609
+ const setRecentlySuccessfulWithSnapshot = useCallback((value) => {
610
+ setRecentlySuccessful(value);
611
+ snapshotRef.current.recentlySuccessful = value;
612
+ }, []);
550
613
  const markAsSuccessful = useCallback(() => {
551
614
  clearErrors();
552
- setWasSuccessful(true);
553
- setRecentlySuccessful(true);
615
+ setWasSuccessfulWithSnapshot(true);
616
+ setRecentlySuccessfulWithSnapshot(true);
554
617
  recentlySuccessfulTimeoutId.current = window.setTimeout(() => {
555
618
  if (isMounted.current) {
556
- setRecentlySuccessful(false);
619
+ setRecentlySuccessfulWithSnapshot(false);
557
620
  }
558
621
  }, config.get("form.recentlySuccessfulDuration"));
559
- }, [clearErrors, setWasSuccessful, setRecentlySuccessful]);
622
+ }, [clearErrors, setWasSuccessfulWithSnapshot, setRecentlySuccessfulWithSnapshot]);
560
623
  const resetBeforeSubmit = useCallback(() => {
561
- setWasSuccessful(false);
562
- setRecentlySuccessful(false);
624
+ setWasSuccessfulWithSnapshot(false);
625
+ setRecentlySuccessfulWithSnapshot(false);
563
626
  clearTimeout(recentlySuccessfulTimeoutId.current);
564
- }, [setWasSuccessful, setRecentlySuccessful]);
627
+ }, [setWasSuccessfulWithSnapshot, setRecentlySuccessfulWithSnapshot]);
565
628
  const finishProcessing = useCallback(() => {
566
629
  setProcessing(false);
567
630
  setProgress(null);
@@ -582,23 +645,43 @@ function useFormState(options) {
582
645
  (field) => typeof field === "string" ? touchedFields.includes(field) : touchedFields.length > 0,
583
646
  [touchedFields]
584
647
  );
585
- const form = {
586
- data,
648
+ const form = useMemo3(() => {
649
+ return {
650
+ get data() {
651
+ return snapshotRef.current.data;
652
+ },
653
+ get isDirty() {
654
+ return !isEqual(snapshotRef.current.data, snapshotRef.current.defaults);
655
+ },
656
+ get errors() {
657
+ return snapshotRef.current.errors;
658
+ },
659
+ get hasErrors() {
660
+ return Object.keys(snapshotRef.current.errors).length > 0;
661
+ },
662
+ get processing() {
663
+ return snapshotRef.current.processing;
664
+ },
665
+ get progress() {
666
+ return snapshotRef.current.progress;
667
+ },
668
+ get wasSuccessful() {
669
+ return snapshotRef.current.wasSuccessful;
670
+ },
671
+ get recentlySuccessful() {
672
+ return snapshotRef.current.recentlySuccessful;
673
+ }
674
+ };
675
+ }, []);
676
+ Object.assign(form, {
587
677
  setData: setDataFunction,
588
- isDirty,
589
- errors,
590
- hasErrors,
591
- processing,
592
- progress: progress2,
593
- wasSuccessful,
594
- recentlySuccessful,
595
678
  transform: transformFunction,
596
679
  setDefaults: setDefaultsFunction,
597
680
  reset,
598
681
  setError,
599
682
  clearErrors,
600
683
  resetAndClearErrors
601
- };
684
+ });
602
685
  const validate = (field, config3) => {
603
686
  if (typeof field === "object" && !("target" in field)) {
604
687
  config3 = field;
@@ -635,12 +718,14 @@ function useFormState(options) {
635
718
  }).on("errorsChanged", () => {
636
719
  const validationErrors = withAllErrorsEnabled() ? validator.errors() : toSimpleValidationErrors(validator.errors());
637
720
  setErrors(validationErrors);
638
- setHasErrors(Object.keys(validationErrors).length > 0);
721
+ snapshotRef.current.errors = validationErrors;
639
722
  setValidFields(validator.valid());
640
723
  });
641
724
  }
642
725
  const precognitiveForm = Object.assign(form, {
643
- validating,
726
+ get validating() {
727
+ return snapshotRef.current.validating;
728
+ },
644
729
  validator: () => validatorRef.current,
645
730
  valid,
646
731
  invalid,
@@ -869,7 +954,7 @@ var deferStateUpdate = (callback) => {
869
954
  typeof React.startTransition === "function" ? React.startTransition(callback) : setTimeout(callback, 0);
870
955
  };
871
956
  var noop = () => void 0;
872
- var FormContext = createContext4(void 0);
957
+ var FormContext = createContext3(void 0);
873
958
  var Form = forwardRef(
874
959
  ({
875
960
  action = "",
@@ -919,10 +1004,10 @@ var Form = forwardRef(
919
1004
  }
920
1005
  form.transform(getTransformedData);
921
1006
  const formElement = useRef4(void 0);
922
- const resolvedMethod = useMemo5(() => {
1007
+ const resolvedMethod = useMemo4(() => {
923
1008
  return isUrlMethodPair(action) ? action.method : method.toLowerCase();
924
1009
  }, [action, method]);
925
- const resolvedComponent = useMemo5(() => {
1010
+ const resolvedComponent = useMemo4(() => {
926
1011
  if (component) {
927
1012
  return component;
928
1013
  }
@@ -1091,11 +1176,11 @@ function useFormContext() {
1091
1176
  var Form_default = Form;
1092
1177
 
1093
1178
  // src/Head.ts
1094
- import { escape } from "lodash-es";
1095
- import React2, { use as use3, useEffect as useEffect7, useMemo as useMemo6 } from "react";
1179
+ import { escape } from "es-toolkit/compat";
1180
+ import React2, { use as use3, useEffect as useEffect7, useMemo as useMemo5 } from "react";
1096
1181
  var Head = function({ children, title }) {
1097
1182
  const headManager = use3(HeadContext_default);
1098
- const provider = useMemo6(() => headManager.createProvider(), [headManager]);
1183
+ const provider = useMemo5(() => headManager.createProvider(), [headManager]);
1099
1184
  const isServer = typeof window === "undefined";
1100
1185
  useEffect7(() => {
1101
1186
  provider.reconnect();
@@ -1192,7 +1277,7 @@ import React3, {
1192
1277
  useCallback as useCallback3,
1193
1278
  useEffect as useEffect8,
1194
1279
  useImperativeHandle as useImperativeHandle2,
1195
- useMemo as useMemo7,
1280
+ useMemo as useMemo6,
1196
1281
  useRef as useRef5,
1197
1282
  useState as useState7
1198
1283
  } from "react";
@@ -1242,11 +1327,12 @@ var InfiniteScroll = forwardRef2(
1242
1327
  const endElementRef = useCallback3((node) => setEndElementFromRef(node), []);
1243
1328
  const [itemsElementFromRef, setItemsElementFromRef] = useState7(null);
1244
1329
  const itemsElementRef = useCallback3((node) => setItemsElementFromRef(node), []);
1330
+ const scrollProp = usePage().scrollProps?.[data];
1245
1331
  const [loadingPrevious, setLoadingPrevious] = useState7(false);
1246
1332
  const [loadingNext, setLoadingNext] = useState7(false);
1247
1333
  const [requestCount, setRequestCount] = useState7(0);
1248
- const [hasPreviousPage, setHasPreviousPage] = useState7(false);
1249
- const [hasNextPage, setHasNextPage] = useState7(false);
1334
+ const [hasPreviousPage, setHasPreviousPage] = useState7(!!scrollProp?.previousPage);
1335
+ const [hasNextPage, setHasNextPage] = useState7(!!scrollProp?.nextPage);
1250
1336
  const [resolvedStartElement, setResolvedStartElement] = useState7(null);
1251
1337
  const [resolvedEndElement, setResolvedEndElement] = useState7(null);
1252
1338
  const [resolvedItemsElement, setResolvedItemsElement] = useState7(null);
@@ -1262,7 +1348,7 @@ var InfiniteScroll = forwardRef2(
1262
1348
  const element = itemsElement ? resolveHTMLElement(itemsElement, itemsElementFromRef) : itemsElementFromRef;
1263
1349
  setResolvedItemsElement(element);
1264
1350
  }, [itemsElement, itemsElementFromRef]);
1265
- const scrollableParent = useMemo7(() => getScrollableParent(resolvedItemsElement), [resolvedItemsElement]);
1351
+ const scrollableParent = useMemo6(() => getScrollableParent(resolvedItemsElement), [resolvedItemsElement]);
1266
1352
  const callbackPropsRef = useRef5({
1267
1353
  buffer,
1268
1354
  onlyNext,
@@ -1280,8 +1366,8 @@ var InfiniteScroll = forwardRef2(
1280
1366
  params
1281
1367
  };
1282
1368
  const [infiniteScroll, setInfiniteScroll] = useState7(null);
1283
- const dataManager = useMemo7(() => infiniteScroll?.dataManager, [infiniteScroll]);
1284
- const elementManager = useMemo7(() => infiniteScroll?.elementManager, [infiniteScroll]);
1369
+ const dataManager = useMemo6(() => infiniteScroll?.dataManager, [infiniteScroll]);
1370
+ const elementManager = useMemo6(() => infiniteScroll?.elementManager, [infiniteScroll]);
1285
1371
  const scrollToBottom = useCallback3(() => {
1286
1372
  if (scrollableParent) {
1287
1373
  scrollableParent.scrollTo({
@@ -1344,11 +1430,11 @@ var InfiniteScroll = forwardRef2(
1344
1430
  setInfiniteScroll(null);
1345
1431
  };
1346
1432
  }, [data, resolvedItemsElement, resolvedStartElement, resolvedEndElement, scrollableParent]);
1347
- const manualMode = useMemo7(
1433
+ const manualMode = useMemo6(
1348
1434
  () => manual || manualAfter > 0 && requestCount >= manualAfter,
1349
1435
  [manual, manualAfter, requestCount]
1350
1436
  );
1351
- const autoLoad = useMemo7(() => !manualMode, [manualMode]);
1437
+ const autoLoad = useMemo6(() => !manualMode, [manualMode]);
1352
1438
  useEffect8(() => {
1353
1439
  autoLoad ? elementManager?.enableTriggers() : elementManager?.disableTriggers();
1354
1440
  }, [autoLoad, onlyNext, onlyPrevious, resolvedStartElement, resolvedEndElement]);
@@ -1444,7 +1530,7 @@ import {
1444
1530
  shouldIntercept,
1445
1531
  shouldNavigate
1446
1532
  } from "@inertiajs/core";
1447
- import { createElement as createElement5, forwardRef as forwardRef3, useEffect as useEffect9, useMemo as useMemo8, useRef as useRef6, useState as useState8 } from "react";
1533
+ import { createElement as createElement5, forwardRef as forwardRef3, useEffect as useEffect9, useMemo as useMemo7, useRef as useRef6, useState as useState8 } from "react";
1448
1534
  var noop2 = () => void 0;
1449
1535
  var Link = forwardRef3(
1450
1536
  ({
@@ -1484,10 +1570,10 @@ var Link = forwardRef3(
1484
1570
  }, ref) => {
1485
1571
  const [inFlightCount, setInFlightCount] = useState8(0);
1486
1572
  const hoverTimeout = useRef6(void 0);
1487
- const _method = useMemo8(() => {
1573
+ const _method = useMemo7(() => {
1488
1574
  return isUrlMethodPair2(href) ? href.method : method.toLowerCase();
1489
1575
  }, [href, method]);
1490
- const resolvedComponent = useMemo8(() => {
1576
+ const resolvedComponent = useMemo7(() => {
1491
1577
  if (component) {
1492
1578
  return component;
1493
1579
  }
@@ -1496,19 +1582,19 @@ var Link = forwardRef3(
1496
1582
  }
1497
1583
  return null;
1498
1584
  }, [component, instant, href]);
1499
- const _as = useMemo8(() => {
1585
+ const _as = useMemo7(() => {
1500
1586
  if (typeof as !== "string" || as.toLowerCase() !== "a") {
1501
1587
  return as;
1502
1588
  }
1503
1589
  return _method !== "get" ? "button" : as.toLowerCase();
1504
1590
  }, [as, _method]);
1505
- const mergeDataArray = useMemo8(
1591
+ const mergeDataArray = useMemo7(
1506
1592
  () => mergeDataIntoQueryString2(_method, isUrlMethodPair2(href) ? href.url : href, data, queryStringArrayFormat),
1507
1593
  [href, _method, data, queryStringArrayFormat]
1508
1594
  );
1509
- const url = useMemo8(() => mergeDataArray[0], [mergeDataArray]);
1510
- const _data = useMemo8(() => mergeDataArray[1], [mergeDataArray]);
1511
- const baseParams = useMemo8(
1595
+ const url = useMemo7(() => mergeDataArray[0], [mergeDataArray]);
1596
+ const _data = useMemo7(() => mergeDataArray[1], [mergeDataArray]);
1597
+ const baseParams = useMemo7(
1512
1598
  () => ({
1513
1599
  data: _data,
1514
1600
  method: _method,
@@ -1538,7 +1624,7 @@ var Link = forwardRef3(
1538
1624
  pageProps
1539
1625
  ]
1540
1626
  );
1541
- const visitParams = useMemo8(
1627
+ const visitParams = useMemo7(
1542
1628
  () => ({
1543
1629
  ...baseParams,
1544
1630
  viewTransition,
@@ -1570,7 +1656,7 @@ var Link = forwardRef3(
1570
1656
  onError
1571
1657
  ]
1572
1658
  );
1573
- const prefetchModes = useMemo8(
1659
+ const prefetchModes = useMemo7(
1574
1660
  () => {
1575
1661
  if (prefetch === true) {
1576
1662
  return ["hover"];
@@ -1585,7 +1671,7 @@ var Link = forwardRef3(
1585
1671
  },
1586
1672
  Array.isArray(prefetch) ? prefetch : [prefetch]
1587
1673
  );
1588
- const cacheForValue = useMemo8(() => {
1674
+ const cacheForValue = useMemo7(() => {
1589
1675
  if (cacheFor !== 0) {
1590
1676
  return cacheFor;
1591
1677
  }
@@ -1594,7 +1680,7 @@ var Link = forwardRef3(
1594
1680
  }
1595
1681
  return config.get("prefetch.cacheFor");
1596
1682
  }, [cacheFor, prefetchModes]);
1597
- const doPrefetch = useMemo8(() => {
1683
+ const doPrefetch = useMemo7(() => {
1598
1684
  return () => {
1599
1685
  router6.prefetch(
1600
1686
  url,
@@ -1669,7 +1755,7 @@ var Link = forwardRef3(
1669
1755
  }
1670
1756
  }
1671
1757
  };
1672
- const elProps = useMemo8(() => {
1758
+ const elProps = useMemo7(() => {
1673
1759
  if (_as === "button") {
1674
1760
  return { type: "button" };
1675
1761
  }
@@ -1712,8 +1798,8 @@ import {
1712
1798
  objectToFormData,
1713
1799
  UseFormUtils as UseFormUtils4
1714
1800
  } from "@inertiajs/core";
1801
+ import { cloneDeep as cloneDeep3 } from "es-toolkit";
1715
1802
  import { toSimpleValidationErrors as toSimpleValidationErrors2 } from "laravel-precognition";
1716
- import { cloneDeep as cloneDeep3 } from "lodash-es";
1717
1803
  import { useCallback as useCallback4, useRef as useRef7, useState as useState9 } from "react";
1718
1804
  function useHttp(...args) {
1719
1805
  const { rememberKey, data, precognitionEndpoint } = UseFormUtils4.parseUseFormArguments(...args);
@@ -1811,7 +1897,7 @@ function useHttp(...args) {
1811
1897
  options.onProgress?.(event);
1812
1898
  }
1813
1899
  });
1814
- const responseData = JSON.parse(httpResponse.data);
1900
+ const responseData = httpResponse.data ? JSON.parse(httpResponse.data) : null;
1815
1901
  if (httpResponse.status >= 200 && httpResponse.status < 300) {
1816
1902
  if (isMounted.current) {
1817
1903
  markAsSuccessful();
@@ -1967,14 +2053,14 @@ function usePrefetch(options = {}) {
1967
2053
 
1968
2054
  // src/WhenVisible.ts
1969
2055
  import { router as router9 } from "@inertiajs/core";
1970
- import { get as get3 } from "lodash-es";
1971
- import { createElement as createElement6, useCallback as useCallback5, useEffect as useEffect12, useMemo as useMemo9, useRef as useRef9, useState as useState11 } from "react";
2056
+ import { get as get3 } from "es-toolkit/compat";
2057
+ import { createElement as createElement6, useCallback as useCallback5, useEffect as useEffect12, useMemo as useMemo8, useRef as useRef9, useState as useState11 } from "react";
1972
2058
  var WhenVisible = ({ children, data, params, buffer, as, always, fallback }) => {
1973
2059
  always = always ?? false;
1974
2060
  as = as ?? "div";
1975
2061
  fallback = fallback ?? null;
1976
2062
  const pageProps = usePage().props;
1977
- const keys = useMemo9(() => data ? Array.isArray(data) ? data : [data] : [], [data]);
2063
+ const keys = useMemo8(() => data ? Array.isArray(data) ? data : [data] : [], [data]);
1978
2064
  const [loaded, setLoaded] = useState11(() => keys.length > 0 && keys.every((key) => get3(pageProps, key) !== void 0));
1979
2065
  const [isFetching, setIsFetching] = useState11(false);
1980
2066
  const fetching = useRef9(false);
@@ -2084,7 +2170,6 @@ export {
2084
2170
  useForm,
2085
2171
  useFormContext,
2086
2172
  useHttp,
2087
- useLayoutProps,
2088
2173
  usePage,
2089
2174
  usePoll,
2090
2175
  usePrefetch,