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

apiset: make ObjectSet.AddSetForType merge instead of replace #5459

Merged
merged 1 commit into from
Feb 7, 2022

Conversation

landism
Copy link
Member

@landism landism commented Feb 7, 2022

Problem

ObjectSet.AddSetForType will blow away any existing objects of the given type, but it's also much easier to read/write than looping over objects.

In the Tiltfile reconciler, which has all of the uses of this method, we have a mix of calls to ObjectSet.AddSetForType and looping over a map and calling Add on objects individually, depending on whether the type had already been added. I added an easy-to-miss bug adding UIButtons here - my buttons blew away any buttons that were added by the Tiltfile. (similarly, if we add ToggleButton to typesWithTiltfileBuiltins, any ToggleButtons from the Tiltfile will get deleted by the later call to AddSetForType)

Solution

Make AddSetForType merge instead of replace. (which also makes that part of api.go cleaner!)

@landism landism requested a review from nicks February 7, 2022 19:19
@landism landism merged commit 9e31d78 into master Feb 7, 2022
@landism landism deleted the matt/apiset_addset_additive branch February 7, 2022 20:33
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