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: object merging with mutation in VFolderTable, hooks, and SessionLauncherPage #2699

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

yomybaby
Copy link
Member

@yomybaby yomybaby commented Sep 10, 2024

TL;DR

Modified _.merge() calls to include an empty object as the first argument.

This PR fixed a bug where the user could not turn on the "Use automatic OpenMP optimization" option after turning it off in the Neo Session Launcher.

image.png

What changed?

Updated three instances of _.merge() function calls in different files:

  1. In VFolderTable.tsx, added an empty object as the first argument to mergedVFolderPermissions.
  2. In backendai.tsx, added an empty object as the first argument when merging deviceMetadata and resourceSlots.
  3. In SessionLauncherPage.tsx, added an empty object as the first argument when merging INITIAL_FORM_VALUES and formValuesFromQueryParams.

Why make this change?

The addition of an empty object as the first argument in _.merge() calls ensures that the original objects are not modified during the merge operation. This prevents potential side effects and maintains the immutability of the source objects, leading to more predictable and safer code behavior.

Copy link

graphite-app bot commented Sep 10, 2024

Your org requires the Graphite merge queue for merging into main

Add the label “flow:merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “flow:hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@github-actions github-actions bot added the size:XS ~10 LoC label Sep 10, 2024
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @yomybaby and the rest of your teammates on Graphite Graphite

Copy link

github-actions bot commented Sep 10, 2024

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements 5.47% 337/6157
🔴 Branches 5.06% 214/4232
🔴 Functions 3.11% 63/2023
🔴 Lines 5.37% 323/6013

Test suite run success

90 tests passing in 11 suites.

Report generated by 🧪jest coverage report action from 9d0dd72

@yomybaby yomybaby marked this pull request as ready for review September 10, 2024 02:34
Copy link
Contributor

@lizable lizable left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link

graphite-app bot commented Sep 10, 2024

Merge activity

…LauncherPage (#2699)

### TL;DR

Modified `_.merge()` calls to include an empty object as the first argument.

This PR fixed a bug where the user could not turn on the "Use automatic OpenMP optimization" option after turning it off in the Neo Session Launcher.

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/XqC2uNFuj0wg8I60sMUh/935c7236-ab00-49a2-a83a-469048b0c31d.png)

### What changed?

Updated three instances of `_.merge()` function calls in different files:
1. In `VFolderTable.tsx`, added an empty object as the first argument to `mergedVFolderPermissions`.
2. In `backendai.tsx`, added an empty object as the first argument when merging `deviceMetadata` and `resourceSlots`.
3. In `SessionLauncherPage.tsx`, added an empty object as the first argument when merging `INITIAL_FORM_VALUES` and `formValuesFromQueryParams`.

### Why make this change?

The addition of an empty object as the first argument in `_.merge()` calls ensures that the original objects are not modified during the merge operation. This prevents potential side effects and maintains the immutability of the source objects, leading to more predictable and safer code behavior.
@lizable lizable force-pushed the fix/lodash-merge-without-mutation branch from 3ebce15 to 9d0dd72 Compare September 10, 2024 03:00
@graphite-app graphite-app bot merged commit 9d0dd72 into main Sep 10, 2024
7 checks passed
@graphite-app graphite-app bot deleted the fix/lodash-merge-without-mutation branch September 10, 2024 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XS ~10 LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants