jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/389538 )
Change subject: Chore: improve RouteParams comments
......................................................................
Chore: improve RouteParams comments
Change-Id: Ic9efffcc9b44eca109cf2d93b5df85234185b858
---
M src/common/pages/summary.tsx
M src/common/pages/wiki.tsx
M src/common/routers/api.test.ts
M src/common/routers/route.ts
4 files changed, 10 insertions(+), 10 deletions(-)
Approvals:
Niedzielski: Looks good to me, approved
Jhernandez: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/common/pages/summary.tsx b/src/common/pages/summary.tsx
index b6037de..4d9c1c3 100644
--- a/src/common/pages/summary.tsx
+++ b/src/common/pages/summary.tsx
@@ -21,6 +21,7 @@
*/
title: PageTitleID | PageTitlePath | string;
}
+
// undefined means random input (Route.toPath()) and {} means random output
// (Route.toParams()).
export type Params = PageParams | { title?: undefined } | undefined;
diff --git a/src/common/pages/wiki.tsx b/src/common/pages/wiki.tsx
index a410686..0f19784 100644
--- a/src/common/pages/wiki.tsx
+++ b/src/common/pages/wiki.tsx
@@ -22,6 +22,7 @@
title: PageTitleID | PageTitlePath | string;
revision?: string;
}
+
// undefined means random input (Route.toPath()) and {} means random output
// (Route.toParams()).
export type Params =
diff --git a/src/common/routers/api.test.ts b/src/common/routers/api.test.ts
index 47a93f0..218e88c 100644
--- a/src/common/routers/api.test.ts
+++ b/src/common/routers/api.test.ts
@@ -22,12 +22,12 @@
params: Params;
}
-const testPathParams = <Params extends RouteParams | undefined>({
+function testPathParams<Params extends RouteParams | undefined>({
name,
route,
path,
params
-}: TestParams<Params>) => {
+}: TestParams<Params>) {
it(`${name} path and parameter types are in sync`, () => {
const expected: RouteParams = {};
Object.keys((params as RouteParams) || {}).forEach(name => {
@@ -51,7 +51,7 @@
const result = route.toParams(path);
assert.deepStrictEqual(result, expected);
});
-};
+}
describe("api", () => {
describe("each route's path and URL path parameters match:", () => {
diff --git a/src/common/routers/route.ts b/src/common/routers/route.ts
index 197aecd..4192965 100644
--- a/src/common/routers/route.ts
+++ b/src/common/routers/route.ts
@@ -4,18 +4,16 @@
/**
* A map of path-to-regexp router path names to matches. The keys must match
- * those specified in RouteConfig.path. Passed to PageModule.requestProps() and
- * Route.toPath().
+ * those specified in RouteConfig.path. This map is passed to Route.toPath()
+ * with unencoded keys, constructed by Route.toParams() with encoded keys, and
+ * passed to PageModule.getInitialProps() with encoded keys. Where applicable,
+ * inputs may be changed by service redirects such as those for title
+ * denormalization.
*
* Note: only strings are ever returned as outputs of Route.toParams() and all
* inputs are converted to strings in Route.toPath().
*/
export interface RouteParams {
- /**
- * When used as an input, an unencoded parameter; when used as an output, an
- * encoded path segment. Where applicable, inputs may be changed by service
- * redirects such as those for title normalization.
- */
[name: string]: string | undefined;
}
--
To view, visit https://gerrit.wikimedia.org/r/389538
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic9efffcc9b44eca109cf2d93b5df85234185b858
Gerrit-PatchSet: 2
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <[email protected]>
Gerrit-Reviewer: Jhernandez <[email protected]>
Gerrit-Reviewer: Niedzielski <[email protected]>
Gerrit-Reviewer: Sniedzielski <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits