-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug?]: route is not a function #11877
Comments
When i check out your repo and run Determining test suites to run...
Running Prisma CLI...
$ yarn prisma db push --force-reset --accept-data-loss --schema ~/redwoodjs-repro-route-not-function/api/db/schema.prisma
Prisma schema loaded from api/db/schema.prisma
Datasource "db": SQLite database "test.db" at "file:~/redwoodjs-repro-route-not-function/.redwood/test.db"
The SQLite database "test.db" at "file:~/redwoodjs-repro-route-not-function/.redwood/test.db" was successfully reset.
🚀 Your database is now in sync with your Prisma schema. Done in 22ms
✔ Generated Prisma Client (v5.20.0) to ./node_modules/@prisma/client in 232ms
PASS api api/src/directives/requireAuth/requireAuth.test.ts
PASS api api/src/directives/skipAuth/skipAuth.test.ts
PASS web web/src/components/ProjectCard/ProjectCard.test.tsx
Test Suites: 3 passed, 3 total
Tests: 4 passed, 4 total
Snapshots: 0 total
Time: 7.588 s
Ran all test suites in 2 projects.
Watch Usage: Press w to show more. also running tests only for the web side with
🤔 One noteworthy thing though: when i run -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
-# yarn lockfile v1
-
-
-"@adobe/css-tools@^4.4.0":
- version "4.4.1"
- resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.4.1.tgz#2447a230bfe072c1659e6815129c03cf170710e3"
- integrity sha512-12WG
+# This file is generated by running "yarn install" inside your project.
+# Manual changes might be lost - proceed with caution!
+
+__metadata:
+ version: 8
+ cacheKey: 10c0
+
+"@adobe/css-tools@npm:^4.4.0":
+ version: 4.4.1
+ resolution: "@adobe/css-tools@npm:4.4.1"
+ checksum:
+10c0/1a68ad9af490f45fce7b6e50dd2d8ac0c546d74431649c0d42ee4ceb1a9fa057fae0a7ef1e148effa12d84ec00ed71869ebfe0fb1dcdcc80bfcb6048c12abcc0
+ languageName: node
+ linkType: hard What's your output of |
It seems like I've trimmed down the example too much and having the watcher running for the web tests did not correctly update. It's passing here too now. Will rework this next week hopefully. One thing to note, if I comment out the route <Route path="/projects/{id:Int}" page={ProjectProjectPage} name="project" /> It seems very similar to the error I'm seeing in the real project. |
@Philzen can you check if razzeee/redwoodjs-repro-route-not-function@7feb8b0 breaks it for you? |
@razzeee The lockfile is still yarn v1. Can you kindly ensure this project is generated with yarn 4?
Also, posting the output of |
Updated the project to use yarn 4, doesn't change the problematic behavior.
|
Thanks, now the good news is: i was able to reproduce it – the bad news is: i'm also not sure what's the root cause here. May be the reduced / conditional exports in v8... definitely seems like jest isn't picking up the generated console.error
The above error occurred in the <ProjectCard> component:
at project (~/redwoodjs-repro-route-not-function/web/src/components/ProjectCard/ProjectCard.tsx:3:24)
at MockParamsProvider (~/redwoodjs-repro-route-not-function/node_modules/@redwoodjs/testing/dist/web/MockParamsProvider.js:36:31)
at LocationProvider (~/redwoodjs-repro-route-not-function/node_modules/@redwoodjs/router/dist/cjs/location.js:41:1)
at GraphQLHooksProvider (~/redwoodjs-repro-route-not-function/node_modules/@redwoodjs/web/dist/cjs/components/GraphQLHooksProvider.js:76:13)
at ErrorBoundary (~/redwoodjs-repro-route-not-function/node_modules/@redwoodjs/web/dist/cjs/apollo/index.js:163:1)
at ApolloProvider (~/redwoodjs-repro-route-not-function/node_modules/@apollo/client/react/context/ApolloProvider.js:6:21)
at ApolloProviderWithFetchConfig (~/redwoodjs-repro-route-not-function/node_modules/@redwoodjs/web/dist/cjs/apollo/index.js:55:42)
at FetchConfigProvider (~/redwoodjs-repro-route-not-function/node_modules/@redwoodjs/web/dist/cjs/components/FetchConfigProvider.js:46:3)
at RedwoodApolloProvider (~/redwoodjs-repro-route-not-function/node_modules/@redwoodjs/web/dist/cjs/apollo/index.js:173:3)
at _HelmetProvider (~/redwoodjs-repro-route-not-function/node_modules/react-helmet-async/lib/index.js:483:5)
at RedwoodProvider (~/redwoodjs-repro-route-not-function/node_modules/@redwoodjs/web/dist/cjs/components/RedwoodProvider.js:38:3)
at MockProviders (~/redwoodjs-repro-route-not-function/node_modules/@redwoodjs/testing/dist/web/MockProviders.js:47:26)
at wrapper |
Just for the lols i ran your project against the current main branch at dcfb077, which gives: FAIL web web/src/components/ProjectCard/ProjectCard.test.tsx
● Test suite failed to run
TypeError: Cannot read properties of undefined (reading 'ReactCurrentDispatcher')
> 1 | import { Link, routes } from '@redwoodjs/router'
| ^
2 |
3 | const ProjectCard = ({ project }: { project: { id: number } }) => {
4 | return <Link to={routes.project({ id: project.id })}>Test</Link>
at web/node_modules/react/cjs/react-jsx-runtime.development.js:328:51
at Object.<anonymous> (web/node_modules/react/cjs/react-jsx-runtime.development.js:1332:5)
at Object.<anonymous> (web/node_modules/react/jsx-runtime.js:6:20)
at Object.require (web/src/components/ProjectCard/ProjectCard.tsx:1:49)
at Object.require (web/src/components/ProjectCard/ProjectCard.test.tsx:3:1) @Tobbe do you have any theory what could be the culprit here? |
What's not working?
I'm running into problems trying to upgrade to redwood 8.
Specifically, when running tests, they throw warnings when using routes and seem to not render correctly after that.
As first mentioned in
https://community.redwoodjs.com/t/redwood-v8-0-0-upgrade-guide/7250/28?u=razzeee
How do we reproduce the bug?
The diff here, should be relevant, as that's the only change from current stock (new project) redwood razzeee/redwoodjs-repro-route-not-function@fe63140
What's your environment? (If it applies)
No response
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: