fix: stop requesting a project by an undefined id after the last one is deleted (#14661)
* fix(frontend): stop querying a project the account no longer has The existence guard in useGetFolderQuery only ran when `params.id` was truthy, so an account with no project left fell straight through to the request and sent the literal string "undefined" as the path segment: GET /api/v1/projects/undefined -> 422 uuid_parsing. Both guards now run before the URL is built, and they resolve the query with `null` instead of returning nothing. Returning `undefined` from a query function is rejected by react-query, which turned every guarded read into a failed query plus a dev-only console error; `null` settles the query as a success carrying no folder, which is what the caller already reads through optional chaining. * refactor(frontend): drop the non-null assertion on the project id `myCollectionId` is `string | null | undefined` and is genuinely empty once the account holds no project, so asserting it away hid from the type checker the very state that produced the invalid request. The folder query now accepts a missing id, so the call site can pass it as it is. * test(frontend): cover the project ids useGetFolderQuery must not request Locks both guards: a missing id (undefined, null or empty) and an id the folder store no longer lists resolve with null and issue no request, while an id the store still lists is requested with the id in the path. Against the previous implementation four of the five cases fail — the missing-id ones because the request goes out as /projects/undefined, and the deleted-project one because the guard resolved with undefined. * test(frontend): fail folder-deletion tests on a non-UUID project request The suite already walked the one-project-to-none transition that produced GET /api/v1/projects/undefined, but nothing looked at what the browser asked for, so the 422 passed unnoticed. Every project request made by these tests is now checked, and any single-segment project id that is not a UUID fails the test that issued it.
T
Tarcio committed
0dd082fc8fe61abfca22e62bb59371ee031f92e9
Parent: ba99f3e
Committed by GitHub <noreply@github.com>
on 8/24/2026, 2:56:28 PM