-
Notifications
You must be signed in to change notification settings - Fork 994
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
fix(web) type NonSuspenseCellQueryResult... #11639
Conversation
@@ -52,11 +52,11 @@ export type CellProps< | |||
> | |||
|
|||
export type CellLoadingProps<TVariables extends OperationVariables = any> = { | |||
queryResult?: NonSuspenseCellQueryResult<TVariables> | SuspenseCellQueryResult | |||
queryResult?: NonSuspenseCellQueryResult<any, TVariables> | SuspenseCellQueryResult |
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.
I think we probably aught to have a type parameter on CellLoadingProps
for TData
here as well. And ideally it should come first on CellLoadingProps
, but that'd be a breaking change 😒
@@ -198,9 +198,10 @@ export type SuspendingSuccessProps = React.PropsWithChildren< | |||
} | |||
|
|||
export type NonSuspenseCellQueryResult< | |||
TData = any, |
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.
Ahh, I see this PR already is breaking because of this type change here.
So what we could do is add TData as the last generic type parameter in this PR. Just to get it released in a patch or minor release.
And then we can follow up with another PR that puts the parameters in the correct order that's breaking and will be released as part of the next major release
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.
@Tobbe good idea!
This is fixed now
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.
@Tobbe could you confirm this is fixed per your feedback and approve to merge? Thanks!
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.
@dthyresson I'll take a look. Thanks for the ping
bbd3958
to
f6b8f95
Compare
Pass through `TData`, instead of `any`
1f0bd30
to
420331c
Compare
@Tobbe I fixed up the prettier error |
Anything I need to do for the failed "Check changesets" task/job? |
You could add a changeset, see https://github.com/redwoodjs/redwood/tree/main/.changesets for example content Thanks! |
Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
Description:
As of RW 7:
Issue:
When using
CellSuccessProps
:queryResult
lost the typings forTData
it used to have in RW 6, namelyqueryResult.fetchMore.data
had theTData
type (fromCellSuccessProps<TData, OperationVariables>
).This also affects
queryResult.previousData
Cause:
NonSuspenseCellQueryResult
no longer accepted theTData
generic type, and hard-codedTData
forQueryOperationResult
to any.Fix:
Pass through
TData
, instead ofany
toQueryOperationResult
and ensure all other inherited types also pass downTData
. Cell Props for Loading and Failure could default toany
.Before the fix:
After the fix: