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(groups): Fix groupsMathDefinitions with deleted group types #18221

Merged
merged 2 commits into from
Oct 27, 2023

Conversation

Twixes
Copy link
Member

@Twixes Twixes commented Oct 26, 2023

Problem

In #18118 we started using an array with only some values initialized for groupTypes, so that we properly account for deleted group types in that mapping. However, it appears that the JS Iterator (internal Slack thread) insist on converting the empty values to undefined instead of skipping (unlike Array itself), which TypeScript doesn't signal (well, we are abusing arrays a bit here).

Changes

To fix the above, let's just use a Map to represent the mapping. This is better than an array, because no-longer-in-use group type indices are skipped in iteration, but also better than an object because iteration order is guaranteed.

CC @tomasfarias

@Twixes Twixes requested a review from neilkakkar October 26, 2023 15:51
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@Twixes Twixes requested a review from thmsobrmlr October 27, 2023 09:44
Copy link
Contributor

@tomasfarias tomasfarias left a comment

Choose a reason for hiding this comment

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

Thanks for looking at this @Twixes!

Copy link
Contributor

@thmsobrmlr thmsobrmlr left a comment

Choose a reason for hiding this comment

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

LGTM

@Twixes Twixes merged commit b9727bb into master Oct 27, 2023
73 checks passed
@Twixes Twixes deleted the fix-groups branch October 27, 2023 11:37
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.

4 participants