Skip to content

Commit

Permalink
Fixing runtime messages
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklafrance committed Oct 19, 2023
1 parent d0c3f4e commit f0777e7
Show file tree
Hide file tree
Showing 2 changed files with 334 additions and 284 deletions.
6 changes: 3 additions & 3 deletions packages/react-router/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class Runtime extends AbstractRuntime<Route, RootNavigationItem> {

if (result.completedPendingRegistrations.length > 0) {
this._logger.debug(
`[squide] The pending registration of the following route${result.completedPendingRegistrations.length > 0 ? "s" : ""} has been %ccompleted%c.`, "color: white; background-color: green;", "%s",
`[squide] The pending registration of the following route${result.completedPendingRegistrations.length !== 1 ? "s" : ""} has been %ccompleted%c.`, "color: white; background-color: green;", "%s",
"Newly registered routes:", result.completedPendingRegistrations,
"All registered routes:", this.#routeRegistry.routes
);
Expand Down Expand Up @@ -67,7 +67,7 @@ export class Runtime extends AbstractRuntime<Route, RootNavigationItem> {
throw new Error("[squide] The \"ManagedRoutes\" outlet route is missing from the router configuration. The \"ManagedRoutes\" outlet route must be added as a children of an hoisted route. Did you forget to include the \"ManagedRoutes\" outlet route or hoist the parent route that includes the \"ManagedRoutes\" outlet route?");
}

let message = `[squide] ${pendingRegistrations.size} parent route${pendingRegistrations.size > 1 ? "s" : ""} were expected to be registered but ${pendingRegistrations.size > 0 ? "are" : "is"} missing:\r\n\r\n`;
let message = `[squide] ${pendingRegistrations.size} parent route${pendingRegistrations.size !== 1 ? "s" : ""} were expected to be registered but ${pendingRegistrations.size !== 0 ? "are" : "is"} missing:\r\n\r\n`;
let index = 0;

// It's easier to use for ... of with a Map object.
Expand All @@ -84,7 +84,7 @@ export class Runtime extends AbstractRuntime<Route, RootNavigationItem> {
message += "\r\n";
}

message += `If you are certain that the parent route${pendingRegistrations.size > 1 ? "s" : ""} has been registered, make sure that the following conditions are met:\r\n`;
message += `If you are certain that the parent route${pendingRegistrations.size !== 1 ? "s" : ""} has been registered, make sure that the following conditions are met:\r\n`;
message += "- The missing parent routes \"path\" or \"name\" property perfectly match the provided \"parentPath\" or \"parentName\" (make sure that there's no leading or trailing \"/\" that differs).\r\n";
message += "- The missing parent routes has been registered with the \"registerRoute()\" function. A route cannot be registered under a parent route that has not be registered with the \"registerRoute()\" function.\r\n";
message += "For more information about nested routes, refers to https://gsoft-inc.github.io/wl-squide/reference/runtime/runtime-class/#register-routes-under-a-specific-nested-layout-route.";
Expand Down
Loading

0 comments on commit f0777e7

Please sign in to comment.