Remove the indexed type reference on AvailableRoutes#8918
Remove the indexed type reference on AvailableRoutes#8918dac09 merged 7 commits intoredwoodjs:mainfrom
Conversation
…ing a route which doesn't exist causes a runtime error (because they are called fns)
|
@jtoar I don't think this should be marked as a breaking change - since it'll actually "break to correct you". If you had a bad route name, it wouldn't complain on build time but fail at run time (which is worse) - this catches those cases. |
|
Yeah happy for it to go in whenever, probably listed it as breaking mostly to remember to include it in v6, but that's out now. I tried to include it for v6, but couldn't get it to pass CI the last time I tried (maybe a few days ago) |
|
@orta looks like with this change a few things don't quite work (trying to index AvailableRoutes). Suggestions for how to fix this?
I just added at the types for AuthenticatedRoutes back - we must haven't missed it during the router refactor! |
|
The generated types might only be available on the web side? But your internal runtime can't know about that, so you'll have to |
Gave this a try.... I just wish I didn't have to do the |
| // Not using AvailableRoutes because the type is generated in the user's project | ||
| // We can't index it correctly in the framework |
There was a problem hiding this comment.
| // Not using AvailableRoutes because the type is generated in the user's project | |
| // We can't index it correctly in the framework | |
| // Not using AvailableRoutes. Because the type is generated in the user's | |
| // project we can't index it correctly in the framework |
There was a problem hiding this comment.
I don't think the grammar on the suggestion is correct ;) Leaving as is.
| import type { GeneratedRoutesMap } from './util' | ||
|
|
||
| export function AuthenticatedRoute(props: any) { | ||
| interface AuthenticatedRouteProps { |
There was a problem hiding this comment.
Pulled this change out into its own PR if we want to keep this one cleaner #8989
Co-authored-by: Daniel Choudhury <[email protected]>
…nto try/apollo-ssr-stream * 'fix/more-streaming-fixes' of github.com:dac09/redwood: (155 commits) Dont inject a null bundle Rename variable Fix for when a page is explicitly imported Add tests fort portal head fix(deps): update dependency vite to v4.4.8 (redwoodjs#9003) fix(deps): update dependency fast-glob to v3.3.1 (redwoodjs#8997) fix(deps): update storybook monorepo to v7.2.0 (redwoodjs#9002) fix(deps): update prisma monorepo to v5.1.0 (redwoodjs#9001) fix(deps): update dependency fastify to v4.21.0 (redwoodjs#8998) fix(deps): update dependency @vitejs/plugin-react to v4.0.4 (redwoodjs#8999) Rename files, update comments Partly backwards compatible Meta tag injection WIP: Stream injection fix(deps): update dependency @whatwg-node/fetch to v0.9.9 (redwoodjs#8942) v6.0.2 Make sure env var name starts with REDWOOD_ENV_ (redwoodjs#8993) fix(realtime): add misisng `@` in setup command Make sure env var name starts with REDWOOD_ENV_ (redwoodjs#8993) fix(realtime): add misisng `@` in setup command Remove the indexed type reference on AvailableRoutes (redwoodjs#8918) ...
…nto try/apollo-ssr-stream * 'fix/more-streaming-fixes' of github.com:dac09/redwood: Whoops Update packages/vite/src/utils.ts More suggestions, fix wrong path on reactRefresh script Use node path for consistency Fix portal head not rendering on the server docs(fonts): Update @font-face recommendation (redwoodjs#8986) Docs: remove useless code in code snippet (redwoodjs#8990) v6.0.3 fix(router): Prevent rerendering authenticated routes on hash change (redwoodjs#9007) Remove the indexed type reference on AvailableRoutes (redwoodjs#8918) Remove debug logs Update packages/vite/src/streamHelpers.ts
…croll-reset * 'main' of github.com:redwoodjs/redwood: fix(deps): update dependency pino to v8.15.0 (redwoodjs#9023) fix(deps): update dependency eslint to v8.46.0 (redwoodjs#9022) fix(deps): update dependency react-hook-form to v7.45.4 (redwoodjs#9017) chore(docs): reversion docs to include recent changes fix(deps): update dependency vite to v4.4.9 (redwoodjs#9018) v6.0.4 fix(docs): update quick start to fix Storybook start up (redwoodjs#9014) cherry pick part of "fix: Improve GraphQL Schema Validation to allow Subscription types when not using Realtime and ensure schema does not use reserved names (redwoodjs#9005)" fix: Improve GraphQL Schema Validation to allow Subscription types when not using Realtime and ensure schema does not use reserved names (redwoodjs#9005) Docs: Explain the entry.client.{jsx,tsx} file (redwoodjs#8987) chore(deps): update dependency esbuild to v0.18.19 (redwoodjs#8983) chore(deps): update dependency nx-cloud to v16.2.0 (redwoodjs#8985) docs(fonts): Update @font-face recommendation (redwoodjs#8986) Docs: remove useless code in code snippet (redwoodjs#8990) v6.0.3 fix(router): Prevent rerendering authenticated routes on hash change (redwoodjs#9007) Remove the indexed type reference on AvailableRoutes (redwoodjs#8918)
because referencing a route which doesn't exist causes a runtime error (because they are called fns) - fixes #8908