Repository navigation
Use a single @ for the Contents view resource routes - #268
Conversation
Resource routes use a single @, like the REST API endpoints and the cmsui resources (@search, @objectBrowserWidget), and views use @@, like @@edit. The Contents view actions were registered as views, nested in the view's layout: /@@contents/@@delete and so on. They move to their own /@contents prefix (/@contents/delete, upload, rename, workflow, tags, properties, order and paste), outside the layout, which their requests never rendered. The convention is now in the routes how-to and the cmsui and contents AGENTS.md. Adds acceptance tests for delete, rename and loading the workflow transitions, which had none.
…source-prefix * feat/resource-routes-skip-content: Document the skipContent route option
|
@pnicolli uncertain about the convention with this one. Since they are resource (actions) routes, should be rooted to
The alternative could be |
|
Yeah I agree that what we have now is not optimal, I think it slipped in with the wrong convention in the years in the making of this package. I think the convention should be:
This way we can avoid conflicts and keep consistency (also with how the restapi looks like, as an added bonus). The reasoning behind nesting of dedicated resource routes here (i.e. |
…source-prefix * feat/resource-routes-skip-content: Drop the object browser breadcrumbs news fragment Add the missing core widgets (#263) Type-check registered widgets and test them against the contract (#262) Give widgets a context instead of the route (#261) Add adapters for the remaining registered controls (#260) Validate schema-driven forms (#256) Move the recurrence modal off TanStack Form (#254) Move the forms onto the helpers form store (#253) Add a Jotai-native form layer to helpers (#252) Render every schema form through one field renderer (#251) Document and type the form widget contract (#97)
As discussed in the PR: the Contents view actions stay nested in the view's path, with a single @ because they are resources, so they don't collide with other add-ons' resources: /@@contents/@delete instead of /@contents/delete.
|
@pnicolli right! implemented! |
…source-prefix * feat/resource-routes-skip-content: Skip the content for resource routes by convention
Their @ paths make them resources, so the root middleware skips the content for them by convention. The routes how-to says so next to the naming convention.
…drasekhar-eab6cd * commit '5729a626fba8358d111bc30925f0294b99346841': Use a single @ for the Contents view resource routes (#268) Let resource routes skip the root content middleware (#265) Update React Aria Components to 1.22 (#273) Add the missing core widgets (#263) Type-check registered widgets and test them against the contract (#262) Give widgets a context instead of the route (#261) Add adapters for the remaining registered controls (#260) Validate schema-driven forms (#256) Move the recurrence modal off TanStack Form (#254) Move the forms onto the helpers form store (#253) Add a Jotai-native form layer to helpers (#252) Render every schema form through one field renderer (#251) Document and type the form widget contract (#97) # Conflicts: # apps/aurora/app/middleware.server.ts
* 'main' of github.com:plone/aurora: Use a single @ for the Contents view resource routes (#268) Let resource routes skip the root content middleware (#265) Update React Aria Components to 1.22 (#273) Add the missing core widgets (#263) Type-check registered widgets and test them against the contract (#262) Give widgets a context instead of the route (#261) Add adapters for the remaining registered controls (#260) Validate schema-driven forms (#256) Move the recurrence modal off TanStack Form (#254) Move the forms onto the helpers form store (#253) Add a Jotai-native form layer to helpers (#252) Render every schema form through one field renderer (#251) Document and type the form widget contract (#97) Match utility dependencies exactly in the registry (#259) Fix the recurrence modal crash for events ending on days 1 to 9 (#255) Scope widget lookups to their category (#249) Subscribe only to the form fields that are read (#248) Give each form its own store and remount it per item (#247) Wait for hydration in sharing acceptance tests (#250) # Conflicts: # apps/aurora/app/middleware.server.ts
Stacked on #265. Merge that first, then retarget this one to
main.Problem
The convention: Aurora resource routes use a single
@, like the REST API endpoints and the cmsui resources (@search,@objectBrowserWidget,@queryStringOptions). Views (routes that render a page) use@@, like@@edit,@@addand@@contents.@plone/contentsregistered its action resource routes with@@, as if they were views:/@@contents/@@delete,@@upload,@@rename,@@workflow,@@tags,@@properties,@@orderand@@paste. They only return data or handle an action, so they're resources. The convention wasn't written down anywhere.Changes
/@@contents/@delete,/@@contents/@upload,/@@contents/@rename,/@@contents/@workflow,/@@contents/@tags,/@@contents/@properties,/@@contents/@orderand/@@contents/@paste. As discussed below, they stay nested in the view's path, so they don't collide with other add-ons' resources. They're registered apart from the Contents layout, which their requests never rendered. Their single-@segment makes them resources, so the root middleware skips the content for them by Let resource routes skip the root content middleware #265's convention, and theirskipContentflags go away. The/*splat is kept, since paste uses it for the target folder.ContentsTableuse the new URLs.docs/how-to-guides/routes.md) and in theAGENTS.mdof cmsui and contents, including nesting a view's own resources in its path, and that the root middleware skips the content for resource routes.breakingfragment in@plone/contents, for any code that calls the old URLs, and adocumentationfragment in the app.Tests
The Contents actions had no acceptance tests. The new
packages/contents/acceptance/tests/contents-actions.test.tscovers:All three fail when the modals call URLs the routes don't match. The contents acceptance suite (7 tests) and contents vitest (33) pass.
check:tsfor@plone/contentsreports the same 13 errors as onmain, all in files this PR doesn't touch.