-
Notifications
You must be signed in to change notification settings - Fork 235
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: noop update from selectors should work #4092
Changes from all commits
faab4b8
7e601b2
77913b4
8bb5526
5073e8a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,13 @@ impl WriteQuery { | |
match self { | ||
Self::CreateRecord(_) => returns_id, | ||
Self::CreateManyRecords(_) => false, | ||
Self::UpdateRecord(_) => returns_id, | ||
Self::UpdateRecord(UpdateRecord::WithExplicitSelection(ur)) => { | ||
ur.selected_fields.is_superset_of(field_selection) | ||
} | ||
Self::UpdateRecord(UpdateRecord::WithImplicitSelection(ur)) => { | ||
ur.selected_fields().is_superset_of(field_selection) | ||
} | ||
Self::UpdateRecord(UpdateRecord::WithoutSelection(_)) => returns_id, | ||
Comment on lines
+67
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a bit out of scope for this PR. This method, |
||
Self::DeleteRecord(_) => returns_id, | ||
Self::UpdateManyRecords(_) => returns_id, | ||
Self::DeleteManyRecords(_) => false, | ||
|
@@ -260,7 +266,7 @@ impl UpdateRecord { | |
pub(crate) fn selected_fields(&self) -> Option<FieldSelection> { | ||
match self { | ||
UpdateRecord::WithExplicitSelection(u) => Some(u.selected_fields.clone()), | ||
UpdateRecord::WithImplicitSelection(u) => Some(u.model.primary_identifier()), | ||
UpdateRecord::WithImplicitSelection(u) => Some(u.selected_fields()), | ||
UpdateRecord::WithoutSelection(_) => None, | ||
} | ||
} | ||
|
@@ -291,6 +297,12 @@ pub struct UpdateRecordWithoutSelection { | |
pub args: WriteArgs, | ||
} | ||
|
||
impl UpdateRecordWithoutSelection { | ||
pub(crate) fn selected_fields(&self) -> FieldSelection { | ||
self.model.primary_identifier() | ||
} | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct UpdateManyRecords { | ||
pub model: Model, | ||
|
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.
The actual fix. The filter generated for the read in the case of a noop update now takes into account the whole
RecordFilter
, thus rendering a filter for selectors too if any are present.