Fix document creation routing to use correct parameter name (#11369)

* Initial plan

* Fix: Use correct route parameter name in DocumentNew

The route parameter is 'collectionSlug', not 'id'. This caused documents
created through /collection/:collectionSlug/new to not have a collectionId,
making them go to drafts instead of the collection.

Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
This commit is contained in:
Copilot
2026-02-08 18:21:06 -05:00
committed by GitHub
parent db42af7fe1
commit ea9e9675fb
+2 -2
View File
@@ -23,11 +23,11 @@ function DocumentNew({ template }: Props) {
const location = useLocation();
const query = useQuery();
const user = useCurrentUser();
const match = useRouteMatch<{ id?: string }>();
const match = useRouteMatch<{ collectionSlug?: string }>();
const { t } = useTranslation();
const { documents, collections, userMemberships, groupMemberships } =
useStores();
const id = match.params.id || query.get("collectionId");
const id = match.params.collectionSlug || query.get("collectionId");
useEffect(() => {
async function createDocument() {