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

feat: Add custom event support to tracker. #227

Merged
merged 3 commits into from
Aug 4, 2023

Conversation

kinyoklion
Copy link
Member

No description provided.

@kinyoklion kinyoklion marked this pull request as ready for review August 3, 2023 22:13
createEvent(): LDMigrationOpEvent | undefined {
if (this.operation && Object.keys(this.contextKeys).length) {
const measurements: LDMigrationMeasurement[] = [];
const measurements: LDMigrationMeasurement[] = [...this.customMeasurements];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const measurements: LDMigrationMeasurement[] = [...this.customMeasurements];
// ts should be able to infer the type automatically?
// also why not just assign the array directly?
const measurements = this.customMeasurements;

Copy link
Member Author

Choose a reason for hiding this comment

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

If it was assigned, and you added another custom event to the same tracker, then it would end up inside the already generated event.

Similarly if you changed the event that was generated it would contaminate the state of the tracker.

Generally it may not be used that way, but it is exposed to outside developers, so I prefer the isolation.

The type should infer now, so I can remove that part.

@kinyoklion kinyoklion merged commit f750bd5 into feat/node-migrations Aug 4, 2023
13 checks passed
@kinyoklion kinyoklion deleted the rlamb/add-custom-events-to-tracker branch August 4, 2023 16:31
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