-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 optimistic effect deletedAt #7606
Conversation
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.
PR Summary
Minor formatting improvement in the OpenAPI parameters utility file, specifically in the computeFilterParameters
function's filter description.
- Removed a newline character in
packages/twenty-server/src/engine/core-modules/open-api/utils/parameters.utils.ts
, making the filter parameter description more compact - This change does not affect the functionality of the
computeFilterParameters
function or its interaction with optimistic effect handling
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
deletedAt: () => recordToDelete.deletedAt, | ||
}, | ||
}); | ||
cache.evict({ id: cache.identify(recordToDestroy) }); |
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.
reverting a previous tentative introduced here: https://github.com/twentyhq/twenty/pull/7200/files
filter: rootQueryFilter, | ||
objectMetadataItem, | ||
}); | ||
const updatedRecordMatchesThisRootQueryFilter = isRecordMatchingFilter({ |
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.
we should always try to matchFilter (as isDeletedAt is implicit)
} | ||
} | ||
|
||
if (updatedRecordShouldBeRemovedFromRootQueryEdges) { |
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.
no changes here, just indent changes
@@ -67,44 +68,69 @@ export const useDeleteManyRecords = ({ | |||
(batchIndex + 1) * mutationPageSize, | |||
); | |||
|
|||
const currentTimestamp = new Date().toISOString(); |
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.
making the useDeleteMany having the EXACT same logic as useUpdateOne but batched
@@ -41,66 +42,85 @@ export const useDeleteOneRecord = ({ | |||
async (idToDelete: string) => { | |||
const currentTimestamp = new Date().toISOString(); | |||
|
|||
const cachedRecord = getRecordFromCache(idToDelete, apolloClient.cache); |
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.
same here
const findManyQueryName = `FindMany${capitalize( | ||
objectMetadataItem.namePlural, | ||
)}`; | ||
const cachedRecords = idsToRestore.map((idToRestore) => |
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.
same here
@@ -120,6 +127,12 @@ export const isRecordMatchingFilter = ({ | |||
); | |||
} | |||
|
|||
if (isLeafFilter(filter)) { |
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.
taking deletedAt into account in the isRecordMatchingFilter
@@ -82,62 +82,62 @@ export class GraphqlQueryFilterFieldParser { | |||
switch (operator) { | |||
case 'eq': | |||
return { | |||
sql: `${objectNameSingular}.${key} = :${key}${uuid}`, | |||
sql: `"${objectNameSingular}"."${key}" = :${key}${uuid}`, |
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.
another bug we spot with @Weiko
@@ -84,8 +84,7 @@ export const computeFilterParameters = (): OpenAPIV3_1.ParameterObject => { | |||
).join('**, **')}**. | |||
Default root conjunction is **${DEFAULT_CONJUNCTION}**. | |||
To filter **null** values use **field[is]:NULL** or **field[is]:NOT_NULL** | |||
To filter using **boolean** values use **field[eq]:true** or **field[eq]:false** | |||
`, | |||
To filter using **boolean** values use **field[eq]:true** or **field[eq]:false**`, |
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.
test fix
In this PR, I'm fixing part of the impact of soft deletion on optimistic rendering.
Backend Vision
Backend current state
Right now, we have the following behavior:
Optimistic rendering strategy