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(store): patch operator must handle existing nulls #2064

Merged

Conversation

TheKingDave
Copy link
Contributor

Changed patch operator not fail when the existing value is null by using a null save access to the key of the object

fixes #2063

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

When the existing value of the patch operator is null/undefined it causes a key access error

Issue Number: #2063

What is the new behavior?

Does not throw an error if existin is null/undefined

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Changed patch operator not fail when the existing value is null
by using a null save access to the key of the object

fixes ngxs#2063
@nx-cloud
Copy link

nx-cloud bot commented Sep 25, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 5db904a. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 3 targets

Sent with 💌 from NxCloud.

Copy link
Member

@markwhitfeld markwhitfeld left a comment

Choose a reason for hiding this comment

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

Thank you so much for the contribution!
Just 2 tweaks to tests.

packages/store/operators/tests/patch.spec.ts Outdated Show resolved Hide resolved
packages/store/operators/tests/patch.spec.ts Outdated Show resolved Hide resolved
Co-authored-by: Mark Whitfeld <markwhitfeld@users.noreply.github.com>
Copy link

bundlemon bot commented Nov 10, 2023

BundleMon (Integration Projects)

Unchanged files (1)
Status Path Size Limits
Main bundles(Gzip)
hello-world-ng15/dist-integration/main.(hash)
.js
63.35KB +1%

Total files change -3B 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

Copy link

codeclimate bot commented Nov 10, 2023

Code Climate has analyzed commit 5db904a and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 95.5%.

View more on Code Climate.

@markwhitfeld markwhitfeld changed the base branch from master to release November 10, 2023 20:34
@markwhitfeld markwhitfeld changed the base branch from release to master November 10, 2023 20:34
@markwhitfeld markwhitfeld changed the title fix(store): made patch operator handle existing null nicely fix(store): patch operator must handle existing nulls Nov 10, 2023
@markwhitfeld markwhitfeld merged commit bd067dd into ngxs:master Nov 10, 2023
12 checks passed
markwhitfeld pushed a commit that referenced this pull request Nov 30, 2023
* fix(store): made patch operator handle existing null nicely

Changed patch operator not fail when the existing value is null
by using a null save access to the key of the object

fixes #2063

* Apply suggestions from code review

Co-authored-by: Mark Whitfeld <markwhitfeld@users.noreply.github.com>

---------

Co-authored-by: Mark Whitfeld <markwhitfeld@users.noreply.github.com>
(cherry picked from commit bd067dd)
@markwhitfeld markwhitfeld added this to the v.18.0.0 milestone Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐞[BUG]: patch operator does not handle null existing values
2 participants