-
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
feat(internal): generate proper types for cells with custom props #6014
Conversation
✅ Deploy Preview for redwoodjs-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 44f5bc5. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 14 targets
Sent with 💌 from NxCloud. |
Very cool! |
thanks a lot for this @codekrafter , that's a cool addition to cells 👍🏻 . @dthyresson I'm too fresh at typescript to be confident in my review, I'd approve it but would appreciate a second opinion. (Edit: posted my approval as I took the opportunity to learn about what puzzled me at first sight ). |
Thanks @codekrafter for this! I think we'll need some test of this behavior. Maybe in the test project to make a cell query for e2e? Or better yet in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codekrafter Please see prior comment. Could you add a test in createCell.test to verify this behavior, thanks!
@codekrafter after leaving the comment, @Tobbe let me know that it is hard to test a TS change. If that's the case, let me know and perhaps instead we add documentation to showcase the behavior and options in the cell docs? |
It is a little hard to test just types, but exploring that testing file I was able to add a general beforeQuery test (which was missing before). There was also a small typing issues with the actual createCell implementation that popped up while adding that test I added a fix for. I also added some content to the |
Thanks -- I now understand much better.
Amazing, Thanks so much for this! |
Testing behavior isn't possible since this is a TS change, but docs were added to explain instead.
@Tobbe LGTM but since you alerted me to the TS change and testing issue, would be great to get your take on the documentation update to explain use. |
Just noticed I had a small typo in the docs for one of my examples, should be fixed now. |
Ref discord conversation at https://discord.com/channels/679514959968993311/998984413167767623
This modifies cell type generation to try to find a
beforeQuery
statement. If it finds one, it uses the first parameter's type as the Props type, instead of the GraphQL query variables.