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 map for Event attributes #226

Merged
merged 2 commits into from
Sep 15, 2023

Conversation

jmcclell
Copy link
Contributor

There are two issues present with the map method today:

  1. Its return type is widened to Attr
  2. It does not propagate all of the properties of the current Event

This means, e.g., if you want to use a pattern where sub-components use their own internal message type which then gets mapped in the parent, events do not map cleanly.

This PR fixes the issues by using the copy method. I have extended the usage of copy to the other, similar map methods, as well, to future-proof in case additional parameters are added to these other attribute classes as seems to have been the case with Event.

Event, specifically, failed to propagate several of its properties.
Using copy will ensure that future parameter additions will work as expected.
Previously, the type was widened to Attr
Copy link
Member

@davesmith00000 davesmith00000 left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you!

@davesmith00000 davesmith00000 merged commit 083d105 into PurpleKingdomGames:main Sep 15, 2023
1 check passed
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