Skip to content

fix(directory): Fix SharedDirectory.forEach() (#25299)#25301

Merged
scottn12 merged 1 commit intomicrosoft:release/client/2.53from
scottn12:cherryPickForEachFix
Aug 25, 2025
Merged

fix(directory): Fix SharedDirectory.forEach() (#25299)#25301
scottn12 merged 1 commit intomicrosoft:release/client/2.53from
scottn12:cherryPickForEachFix

Conversation

@scottn12
Copy link
Contributor

This PR cherry-picks 1b1514f from main to fix a bug with SharedDirectory.forEach().

## Description

This PR fixes `SharedDirectory.forEach()` as it no longer tries to unbox
the value. It also adds a test to prevent this regression in the future.
@github-actions github-actions bot added area: dds Issues related to distributed data structures base: release PRs targeted against a release branch labels Aug 25, 2025
@github-actions
Copy link
Contributor

Warning

WARNING: This PR is targeting a release branch!

All changes must first be merged into main and then backported to the target release branch.
Please include a link to the main PR in the description of this PR.

Changes to release branches require approval from the Patch Triage group before merging.
You should have already discussed this change with them so they know to expect it.

For more details, see our internal documentation for the patch policy and processes for
patch releases.

@scottn12 scottn12 marked this pull request as ready for review August 25, 2025 18:53
Copilot AI review requested due to automatic review settings August 25, 2025 18:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in SharedDirectory.forEach() where the callback was incorrectly receiving the internal value object instead of the actual stored value. The fix ensures that forEach() properly passes the unwrapped value to the callback function.

Key changes:

  • Fixed the forEach() implementation to pass the correct value parameter
  • Added comprehensive test coverage for the forEach() method

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/dds/map/src/directory.ts Fixed forEach() to pass localValue directly instead of accessing .value property
packages/dds/map/src/test/mocha/directory.spec.ts Added test case to verify forEach() iterates correctly over directory entries

@frankmueller-msft frankmueller-msft self-requested a review August 25, 2025 19:18
Copy link

@frankmueller-msft frankmueller-msft left a comment

Choose a reason for hiding this comment

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

:shipit:

@scottn12 scottn12 merged commit a33ba13 into microsoft:release/client/2.53 Aug 25, 2025
39 checks passed
@scottn12 scottn12 deleted the cherryPickForEachFix branch August 25, 2025 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: dds Issues related to distributed data structures base: release PRs targeted against a release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants