You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 16cf6a2
Browse filesBrowse the repository at this point in the historyBrowse files
feat: warn on repeatable params being passed as scalars (#2879)
* test(resolver-fixed): return arrays from the repeatable test matcher
* fix(matcher): warn when a repeatable param is not an array
Repeatable params must be arrays. Pass [] or null to remove an optional one.
* feat(experimental): warn when a repeatable param is not an array
* feat(matcher): warn when an optional param is removed with an empty string
Matches the experimental router. Use null instead.
* docs(diagnostics): limit R0106 removal guidance to optional params
* fix(matcher): check explicit params in relative locations
* test: use codes
* docs: up
When specifying `params`, make sure to either provide a `string` or `number`(or an array of these for [repeatable params](./route-matching-syntax.md#Repeatable-params)). **Any other type (like objects, booleans, etc) will be automatically stringified**. For [optional params](./route-matching-syntax.md#Optional-parameters), you can provide an empty string (`""`) or `null` as the value to remove it.
70
+
When specifying `params`, provide a `string` or `number`for a regular param. For [repeatable params](./route-matching-syntax.md#Repeatable-params), always provide an array, even when it has one item. To remove an optional repeatable param, provide an empty array (`[]`) or `null`. **Any other type (like objects or booleans) will be automatically stringified**. For other [optional params](./route-matching-syntax.md#Optional-parameters), provide `null` to remove it.
71
71
72
72
Since the prop `to` accepts the same kind of object as `router.push`, the exact same rules apply to both of them.
`Finding ancestor route "${p.ancestor}" failed for "${p.record}"`,
338
338
fix: 'Report a reproduction at https://github.com/vuejs/router/issues/new/choose.',
339
339
},
340
+
VUE_ROUTER_R0106: {
341
+
why: (p: {name: string})=>
342
+
`Repeatable param "${p.name}" was provided without an array.`,
343
+
fix: (p: {name: string})=>
344
+
`Pass it as an array, even when it has one item: { ${JSON.stringify(p.name)}: [value] }. If the param is optional (e.g. ":${p.name}*"), pass an empty array or null to remove it.`,
0 commit comments