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: Git discarding null properties #25068

Merged
merged 31 commits into from
Jul 4, 2023

Conversation

NilanshBansal
Copy link
Contributor

Description

The git discard flow only discards the properties which were set in the last commit. If the properties are not present in the application json in the last commit and the user changes these properties to some value and after that choose to discard, the changes are not overwritten to null values.

This happens because git uses a function copyNestedNonNullProperties to overwrite the values to the last commit ones which ignores the properties if those are null.

This PR explicitly sets the null properties in the target json, so that when the user discards the initially set null properties, these get discarded.

PR fixes following issue(s)

Fixes #24920

Media

A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Testing

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration.
Delete anything that is not relevant

  • Manual
  • Jest
  • Cypress

Test Plan

Add Testsmith test cases links that relate to this PR

Issues raised during DP testing

Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR)

Checklist:

Dev activity

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • PR is being merged under a feature flag

QA activity:

  • Speedbreak features have been covered
  • Test plan covers all impacted features and areas of interest
  • Test plan has been peer reviewed by project stakeholders and other QA members
  • Manually tested functionality on DP
  • We had an implementation alignment call with stakeholders post QA Round 2
  • Cypress test cases have been added and approved by SDET/manual QA
  • Added Test Plan Approved label after Cypress tests were reviewed
  • Added Test Plan Approved label after JUnit tests were reviewed

@github-actions github-actions bot added App Navigation Issues related to the topbar navigation and configuring it Widgets Product This label groups issues related to widgets Bug Something isn't working labels Jul 4, 2023
@NilanshBansal NilanshBansal enabled auto-merge (squash) July 4, 2023 12:56
@NilanshBansal NilanshBansal disabled auto-merge July 4, 2023 12:57
@NilanshBansal
Copy link
Contributor Author

/build-deploy-preview

@github-actions
Copy link

github-actions bot commented Jul 4, 2023

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/5454983633.
Workflow: On demand build Docker image and deploy preview.
skip-tests: . env: .
PR: 25068.
recreate: .

@github-actions
Copy link

github-actions bot commented Jul 4, 2023

Deploy-Preview-URL: https://ce-25068.dp.appsmith.com

@github-actions
Copy link

github-actions bot commented Jul 4, 2023

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/5454629105.
Commit: ``.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ClientSide/Git/GitDiscardChange/DiscardChanges_spec.js

  2. cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad1_Spec.ts
To know the list of identified flaky tests - Refer here

Copy link
Member

@AnaghHegde AnaghHegde left a comment

Choose a reason for hiding this comment

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

I still don’t see the test cases for this scenario

@github-actions
Copy link

github-actions bot commented Jul 4, 2023

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/5454957886.
Commit: ``.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/Apps/MongoDBShoppingCart_spec.ts

  2. cypress/e2e/Regression/ClientSide/Git/GitDiscardChange/DiscardChanges_spec.js
  3. cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad1_Spec.ts
To know the list of identified flaky tests - Refer here

@github-actions
Copy link

github-actions bot commented Jul 4, 2023

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/5454957886.
Commit: ``.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

@NilanshBansal NilanshBansal requested a review from AnaghHegde July 4, 2023 17:40
@NilanshBansal
Copy link
Contributor Author

/ok-to-test

@github-actions
Copy link

github-actions bot commented Jul 4, 2023

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/5457305023.
Workflow: Appsmith External Integration Test Workflow.
Commit: ``.
PR: 25068.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=25068&runId=5457305023_1

@NilanshBansal
Copy link
Contributor Author

NilanshBansal commented Jul 4, 2023

Here is the screen recording of the fixed flow on DP

Screen.Recording.2023-07-04.at.11.24.18.PM.mov

cc: @Parthvi12 @ginilpg

Copy link
Contributor

@abhvsn abhvsn left a comment

Choose a reason for hiding this comment

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

Added very minor comment.

@NilanshBansal NilanshBansal requested a review from abhvsn July 4, 2023 18:38
@NilanshBansal
Copy link
Contributor Author

/ok-to-test

@github-actions
Copy link

github-actions bot commented Jul 4, 2023

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/5457669634.
Workflow: Appsmith External Integration Test Workflow.
Commit: ``.
PR: 25068.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=25068&runId=5457669634_1

@NilanshBansal NilanshBansal enabled auto-merge (squash) July 4, 2023 18:48
@github-actions
Copy link

github-actions bot commented Jul 4, 2023

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/5457305023.
Commit: ``.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

@NilanshBansal NilanshBansal disabled auto-merge July 4, 2023 19:39
@NilanshBansal NilanshBansal dismissed AnaghHegde’s stale review July 4, 2023 19:40

Requested changes done

@NilanshBansal NilanshBansal merged commit 081d417 into release Jul 4, 2023
@NilanshBansal NilanshBansal deleted the fix/issue-24920/git-discard-null-properties branch July 4, 2023 19:40
@github-actions
Copy link

github-actions bot commented Jul 4, 2023

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/5457669634.
Commit: ``.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

arunvjn pushed a commit that referenced this pull request Jul 5, 2023
## Description
> The git discard flow only discards the properties which were set in
the last commit. If the properties are not present in the application
json in the last commit and the user changes these properties to some
value and after that choose to discard, the changes are not overwritten
to null values.

> This happens because git uses a function `copyNestedNonNullProperties`
to overwrite the values to the last commit ones which ignores the
properties if those are null.

> This PR explicitly sets the null properties in the target json, so
that when the user discards the initially set null properties, these get
discarded.

#### PR fixes following issue(s)
Fixes #24920

#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
> Please delete options that are not relevant.
- Bug fix (non-breaking change which fixes an issue)

## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [ ] Manual
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag

#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed

(cherry picked from commit 081d417)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Navigation Issues related to the topbar navigation and configuring it Bug Something isn't working Git Platform Issues related to the git & the app platform Git Product Issues related to version control product High This issue blocks a user from building or impacts a lot of users Production Release Blocker This issue must be resolved before the release Widgets Product This label groups issues related to widgets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Not able to discard app settings changes for the first time in git connected app
3 participants