clear-react-router 1.6.8 → 1.6.9

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -112,7 +112,7 @@ var useCurrentLoaderState = createState(emptyLoaderState);
112
112
  var useScrollMap = createState({});
113
113
  var useContextState = createState({});
114
114
  //#endregion
115
- //#region \0@oxc-project+runtime@0.132.0/helpers/typeof.js
115
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
116
116
  function _typeof(o) {
117
117
  "@babel/helpers - typeof";
118
118
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -122,7 +122,7 @@ function _typeof(o) {
122
122
  }, _typeof(o);
123
123
  }
124
124
  //#endregion
125
- //#region \0@oxc-project+runtime@0.132.0/helpers/toPrimitive.js
125
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
126
126
  function toPrimitive(t, r) {
127
127
  if ("object" != _typeof(t) || !t) return t;
128
128
  var e = t[Symbol.toPrimitive];
@@ -134,13 +134,13 @@ function toPrimitive(t, r) {
134
134
  return ("string" === r ? String : Number)(t);
135
135
  }
136
136
  //#endregion
137
- //#region \0@oxc-project+runtime@0.132.0/helpers/toPropertyKey.js
137
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
138
138
  function toPropertyKey(t) {
139
139
  var i = toPrimitive(t, "string");
140
140
  return "symbol" == _typeof(i) ? i : i + "";
141
141
  }
142
142
  //#endregion
143
- //#region \0@oxc-project+runtime@0.132.0/helpers/defineProperty.js
143
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
144
144
  function _defineProperty(e, r, t) {
145
145
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
146
146
  value: t,
@@ -740,15 +740,15 @@ var Form = ({ children, action: actionKey, onSuccess, onError, autoReset = true
740
740
  const [isSubmitting, setIsSubmitting] = useState(false);
741
741
  const onSubmit = async (evt) => {
742
742
  evt.preventDefault();
743
- if (!routeItem) throw new Error("route not found");
744
- if (!routeItem.actions) throw new Error("route action creator not found");
743
+ if (!routeItem) throw new Error("Route not found");
744
+ if (!routeItem.actions) throw new Error("Route action creator not found");
745
745
  const action = routeItem.actions({
746
746
  context,
747
747
  setContext,
748
748
  params,
749
749
  invalidate
750
750
  })[actionKey];
751
- if (!action) throw new Error("action not found");
751
+ if (!action) throw new Error(`Action "${actionKey}" not found`);
752
752
  try {
753
753
  setIsSubmitting(true);
754
754
  const result = await action(new FormData(evt.target));
@@ -829,15 +829,15 @@ var useAction = (actionKey, onError) => {
829
829
  const { routeItem } = routeItemData;
830
830
  const latestContext = useLatest(context);
831
831
  return useCallback(async (formData) => {
832
- if (!routeItem) throw new Error("route not found");
833
- if (!routeItem.actions) throw new Error("route action creator not found");
832
+ if (!routeItem) throw new Error("Route not found");
833
+ if (!routeItem.actions) throw new Error("Route action creator not found");
834
834
  const action = routeItem.actions({
835
835
  context: latestContext.current,
836
836
  setContext,
837
837
  params,
838
838
  invalidate
839
839
  })[actionKey];
840
- if (!action) throw new Error("action not found");
840
+ if (!action) throw new Error(`Action "${actionKey}" not found`);
841
841
  try {
842
842
  await action(formData);
843
843
  await invalidate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clear-react-router",
3
- "version": "1.6.8",
3
+ "version": "1.6.9",
4
4
  "description": "A lightweight, type-safe routing library for React applications",
5
5
  "author": "Andrew Bubnov",
6
6
  "scripts": {