Skip to content
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(hadron-document): allow expanding an element that has its type changed to array or object COMPASS-7929 #6013

Merged
merged 4 commits into from
Jul 16, 2024

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Jul 10, 2024

Copy link
Collaborator

@gribnoysup gribnoysup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved because I know it fixes the issue and is not introducing new issues, but I'm still confused by the _isExpandable implementation 😆

Comment on lines 471 to 473
isValueExpandable(this.originalExpandableValue) ||
(this.isModified() &&
(this.currentType === 'Array' || this.currentType === 'Object'))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that this is just preserving existing code, but the more I look at it, the less sense it makes, sorry 😅 If you edited the element to a non-expandable type, changed Object to String say, this would still return true, which just doesn't sound right? Feels like the check you are adding instead, the one that looks at the currentType, is actually the best way to check for this instead of checking the value and is the only thing we need to check for, does this makes sense or is there a case I'm missing where looking at the original value is required?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good callout! Removed everything except the current type check.

@Anemy Anemy merged commit 092034f into main Jul 16, 2024
30 checks passed
@Anemy Anemy deleted the COMPASS-7929-fix-add-field-to-doc branch July 16, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants