Return params as an object in custom views instead of a segments array #14065
tyteen4a03
started this conversation in
Feature Requests & Ideas
Replies: 1 comment
-
Changed this into a discussion as it wasn't strictly an issue, we've had a change in functionality moving over from v2 but this is still a valid change request |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Link to reproduction
No response
Environment Info
Node.js v22.7.0
Binaries:
Node: 22.7.0
npm: 10.8.2
Yarn: N/A
pnpm: 9.12.1
Relevant Packages:
payload: 3.0.0-beta.113
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.0.0: Tue Sep 24 23:39:07 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T6000
Available memory (MB): 32768
Available CPU cores: 10
Describe the Bug
In Payload v2, passing parameters to
path
in custom views (e.g./my-path/:id/test
) would pass theparams
as parsed by path-to-regexp to the child component. However, in v3 this was removed and even the example provided byCustomViewWithParam
refer to the param by the index in the segments, instead of the namedid
parameter, which isn't ideal.Reproduction Steps
See
payload/test/admin/components/views/CustomViewWithParam/index.tsx
Line 26 in 86fdad0
:id
param, but the test does not / cannot make use ofid
being named, because onlysegments
is returned.Adapters and Plugins
No response
Beta Was this translation helpful? Give feedback.
All reactions