Skip to content

fix: send modification notification when map indexer adds a new value. - #18

Merged
wlsnmrk merged 2 commits into
chickensoft-games:mainfrom
wlsnmrk:fix/map-indexer-notify-modified
Jul 1, 2026
Merged

fix: send modification notification when map indexer adds a new value.#18
wlsnmrk merged 2 commits into
chickensoft-games:mainfrom
wlsnmrk:fix/map-indexer-notify-modified

Conversation

@wlsnmrk

@wlsnmrk wlsnmrk commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Using the AutoMap indexer to write a new key-value pair into the map will now invoke callbacks registered via OnModify():

var myAutoMap = new AutoMap<int, int>();
myAutoMap.OnModify(() => Print("myAutoMap modified!"));
// will now print "myAutoMap modified!"
myAutoMap[0] = 0;

This behavior was failing previously.

Also added tests to verify that both OnAdd() and OnModify() callbacks are invoked when new key-value pairs are added via indexer.

(Thanks to @CaseyHofland for spotting this!)

wlsnmrk added 2 commits July 1, 2026 03:06
Note that the tests previously named "Update-" are testing the indexer,
and add tests for the add behavior of the indexer.

Note: One new test failing.
Fix failing test for AutoMap indexer by broadcasting a modification
notification when an update op is actually an add op.
@wlsnmrk wlsnmrk changed the title Fix: Send modification notification when map indexer adds a new value. fix: send modification notification when map indexer adds a new value. Jul 1, 2026
@wlsnmrk
wlsnmrk merged commit 5294a03 into chickensoft-games:main Jul 1, 2026
2 checks passed
@wlsnmrk
wlsnmrk deleted the fix/map-indexer-notify-modified branch July 1, 2026 07:19
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.

1 participant