just want to leave this here for others running into Performance issues when using Redwood in VSCode. (did not find comparable posts yet). Our codebase was pretty slow, with intellisense taking sometimes few seconds.
Using zod and having some bigger schema validation, we were checking, if zod was the issue. But the solution to faster typescript autocomplete and intellisense seems to be Strict Mode. Redwood supports it already, but does not turn it on by default. It is well documented though TypeScript Strict Mode | RedwoodJS Docs
Related Zod issue:
08:54PM - 13 Feb 23 UTC
I spent much of last week investigating why my work's codebase was taking 2-3 se
… conds to populate autocomplete or refresh code-intelligence during code changes, and after a lot of tsc tracing and replacing Zod types with `any`, I found that basically the entire time is being taken up processing Zod types - specifically those using masking (Extend, Omit, Pick) methods.
After removing all uses of masking and dropping back to Zod 3.19 on the suggestion of some comments in the issues, the codebase is now down to 1.5 seconds for autocomplete which is still a lot of time.
I've written this up in a little more detail [here](https://dev.to/nicklucas/typescript-runtime-validators-and-dx-a-type-checking-performance-analysis-of-zodsuperstructyuptypebox-5416) and have a small-scale reproduction [here](https://github.com/Nick-Lucas/gapstack/tree/main/packages/light-type-benchmarks) which was used in the benchmarks.
Eventually I do plan on a more in-depth benchmarking across a larger variety of methods, as these benchmarks are a somewhat blunt instrument, but it would be great to see type inference performance improved across the board as Zod is lagging behind the competition even in the most basic situations.
Redwood is speedy now :)))
February 28, 2023, 3:50pm
I’m struggling with importing cells, as they don’t have default exports, how did you handle those?
Seem to be the last thing I need for
yarn rw type-check to be happy
Thanks for getting back.
I think I can do
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
import SurveyCell from 'src/components/SurveyCell/SurveyCell'
But that probably shouldn’t be the prefered solution
@danny and @Tobbe can help and know how to deal with this, since they worked on Strict Mode support in redwood v3 release?
March 1, 2023, 8:58am
does changing the import to
import SurveyCell from 'src/components/SurveyCell'
help at all?
If not, try running
yarn rw g types - this is because Redwood’s special import syntax needs “mirror” definitions defined behind the scenes for you.
Generated Types | RedwoodJS Docs
Usually most people develop with the dev server running, so its constantly generating these types for you.
That seems to solve it yes.
On a side note, lol, I have been dreading cell imports for months, due to giving me red squigglies…
March 1, 2023, 10:18am
I hear you. Definitely one of the weirder parts of Redwood, and something I wish I could solve.
VSCode doesn’t seem to understand how to use the mirror cells in it’s autosuggestions - but unfortunately we don’t really have enough time/people in the team to help with creating a language server plugin to help with these cases.
I’m curious where I got the idea from to import like that.
Looking at the docs Redwood Utility Types | RedwoodJS Docs seems to suggest to name files
***.cell.tsx, which isn’t what the generator does? So that’s confusing to me.
March 3, 2023, 7:01pm
Yeah, that looks wrong. Do you want to write a PR to fix it?
March 3, 2023, 7:04pm
I tried to get VSCode to auto-complete cell imports, but got stuck and ran out of time. Any help to get it working would be greatly appreciated
01:40PM - 24 Jun 22 UTC
Splits the generator file watching into two. One for the API sid
… e and one for the Web side.
The Web side watcher now also watches for directory changes. It was the only way to catch directories that were being renamed. When a Cell directory is unlinked we now also remove the corresponding mirror directory.
To be clear, you mean fix the docs?
March 5, 2023, 5:37pm
The names are XyzCell.tsx (not Xyz.cell.tsx)
I think I ended up with this cause vscode can still suggest to import the story for the cell, so I probably just did that and removed the story ending.