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

Allow Cube Query to opt-out of flattening redundant children #3867

Merged
merged 3 commits into from
Dec 24, 2024

Conversation

TomTirapani
Copy link
Member

See issue: #3843

Seemed like a quick win, that would allow us to clean up some code at a flagship client app. Wasn't sure about the name, its tricky to describe what this does in just a couple of words - any suggestions welcome!

Hoist P/R Checklist

Pull request authors: Review and check off the below. Items that do not apply can also be
checked off to indicate they have been considered. If unclear if a step is relevant, please leave
unchecked and note in comments.

  • Caught up with develop branch as of last change.
  • Added CHANGELOG entry, or determined not required.
  • Reviewed for breaking changes, added breaking-change label + CHANGELOG if so.
  • Updated doc comments / prop-types, or determined not required.
  • Reviewed and tested on Mobile, or determined not required.
  • Created Toolbox branch / PR, or determined not required.

If your change is still a WIP, please use the "Create draft pull request" option in the split
button below to indicate it is not ready yet for a final review.

Pull request reviewers: when merging this P/R, please consider using a squash commit to
collapse multiple intermediate commits into a single commit representing the overall feature
change. This helps keep the commit log clean and easy to scan across releases. PRs containing a
single commit should be rebased when possible.

@lbwexler
Copy link
Member

We discussed, and I like this change al ot, as it also helps document a bit of a subtle behavior.

One unfortunate/confusing thing is that it is a lot like an omitFn, and I suppose we might have been able to implement it as an omitFn, although because of its recursive nature of zapping multiple nodes in a chain, I am not sure how straightforward that would be.

Perhaps we should call it omitRedundantNodes or flattenRedundantNodes?

@lbwexler
Copy link
Member

I think it really is an omitFn. We could make it the default omit function on cube e.g. Cube.omitFn = omitRedundantNodes but that would be a breaking change for anyone overriding the omitFn, who would now have to also refer to the default implementation.

Maybe best to just call it omitRedundantNodes and have omitFn and omitRedundantNodes just mention each other in their docstrings.

@lbwexler lbwexler merged commit 5fb6b28 into develop Dec 24, 2024
2 checks passed
@lbwexler lbwexler deleted the cubeQueryRedundantChildren branch December 24, 2024 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants