-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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(db-postgres): Remove duplicate keys from response #4747
fix(db-postgres): Remove duplicate keys from response #4747
Conversation
if ('name' in field && Boolean(field?.name)) { | ||
const fieldToDelete = `${groupFieldPrefix}${field.name}` | ||
|
||
deletions.push(() => delete ref[fieldToDelete]) |
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.
As I read this I realize that what we talked about here isn't quite right.
Instead of having the loop on the fields at this iteration, we should be deleting the fields if there is a fieldPrefix
when we iterate on the field.
If we do it this way we can be sure that fields nested in rows and collapsibles are also deleted from the parent. The way this PR is written we wouldn't be catching those.
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 mislead you on the call we had. We need to push to deletion in the existing reduce function at line 115 if there is a fieldPrefix. This way the extra data will be removed if you have group
-> row
-> text
for example.
Is there a situation where |
I don't think so? The resulting doc should nest all properties into the field structure defined in the config. Prefixes aren't a thing in that context. I assume our test coverage will tell us pretty quickly. |
I updated it at 118 and it passes the test coverage. I also noticed that Sorry the linter wanted to reorder objects and imports all over the file so the diff is a bit miffed. |
I believe this also fixed #4221 |
Closes #4709
Description
Type of change
Checklist: