clear-react-router 1.7.8 → 1.7.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 +7 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -210,6 +210,7 @@ var parseWindowLocation = (location) => ({
210
210
  search: location.search
211
211
  });
212
212
  var comparePaths = (el, pathname) => {
213
+ if (!el.params?.length) return el.path.replaceAll("/", "") === pathname.replaceAll("/", "");
213
214
  const splitElementPath = el.path.split("/").filter(Boolean);
214
215
  const paramsLength = el.params ? Object.keys(el.params).length : 0;
215
216
  const splitPathname = pathname.split("/").filter(Boolean);
@@ -338,13 +339,11 @@ var beforeLoad = async (routeItem, params) => {
338
339
  const { beforeLoad } = routerConfig;
339
340
  const runBeforeLoad = async (loaderFn) => {
340
341
  const redirect = async (redirected) => await navigate(typeof redirected === "string" ? { pathname: redirected } : redirected);
341
- const { context, setContext } = getContext();
342
342
  try {
343
343
  await loaderFn({
344
- context,
344
+ ...getContext(),
345
345
  redirect,
346
- params,
347
- setContext
346
+ params
348
347
  });
349
348
  loaderStateRef.set((prev) => ({
350
349
  ...prev,
@@ -385,16 +384,13 @@ var loader = async (routeItem, location) => {
385
384
  };
386
385
  var afterLoad = async (routeItem, params) => {
387
386
  const { afterLoad } = routerConfig;
388
- const { context, setContext } = getContext();
389
387
  if (routeItem?.afterLoad) await routeItem.afterLoad({
390
- context,
391
- params,
392
- setContext
388
+ ...getContext(),
389
+ params
393
390
  });
394
391
  if (afterLoad) await afterLoad({
395
- context,
396
- params,
397
- setContext
392
+ ...getContext(),
393
+ params
398
394
  });
399
395
  };
400
396
  var navigate = async (nextLocation) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clear-react-router",
3
- "version": "1.7.8",
3
+ "version": "1.7.9",
4
4
  "description": "A lightweight, type-safe routing library for React applications",
5
5
  "author": "Andrew Bubnov",
6
6
  "scripts": {