@zubyjs/react 1.0.32 → 1.0.34

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zubyjs/react",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "Zuby.js JsxProvider for react",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/router.js CHANGED
@@ -29,7 +29,11 @@ export default function Router({ context }) {
29
29
  const error = errors.find(({ pathRegex }) => {
30
30
  return pathRegex.test(context.url.pathname ?? '');
31
31
  });
32
- const page = (_jsx(WouterSwitch, { children: pages.map((page) => (_jsx(WouterRoute, { path: page.path, children: _jsx(page.component, { context: context }) }))) }));
32
+ const routes = [
33
+ ...pages.map((page) => (_jsx(WouterRoute, { path: page.path, children: _jsx(page.component, { context: context }) }, page.path))),
34
+ _jsx(WouterRoute, { children: error?.component && (_jsx(error.component, { context: context, statusCode: (context.statusCode = 404), message: 'Page was not found' })) }, "error"),
35
+ ];
36
+ const page = _jsx(WouterSwitch, { children: routes });
33
37
  return (_jsx(WouterRouter, { ssrPath: context.url.pathname, children: _jsx(Suspense, { fallback: _jsx("div", { children: "Loading..." }), children: createElement(app?.component, {
34
38
  children: page,
35
39
  }) }) }));
@@ -1,2 +1,5 @@
1
1
  import { PropsWithChildren } from 'react';
2
- export default function Error({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
2
+ export default function Error({ statusCode, message, }: PropsWithChildren<{
3
+ statusCode: number;
4
+ message: string;
5
+ }>): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- export default function Error({ children }) {
3
- return _jsx(_Fragment, { children: children });
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export default function Error({ statusCode, message, }) {
3
+ return (_jsxs("div", { children: [_jsx("h1", { children: statusCode }), _jsx("p", { children: message })] }));
4
4
  }