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: depercate form button widget #14510

Merged
merged 18 commits into from
Jul 22, 2022
Merged

fix: depercate form button widget #14510

merged 18 commits into from
Jul 22, 2022

Conversation

techbhavin
Copy link
Contributor

Description

Deprecate the form button widget

Fixes #3613

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • 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

@techbhavin techbhavin added the Widgets Product This label groups issues related to widgets label Jun 14, 2022
@vercel
Copy link

vercel bot commented Jun 14, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
appsmith ✅ Ready (Inspect) Visit Preview Jul 22, 2022 at 6:13AM (UTC)

@techbhavin techbhavin changed the title fix : depercate form button widget fix: depercate form button widget Jun 14, 2022
@github-actions github-actions bot added Enhancement New feature or request Form Widget UI Building Pod and removed Enhancement New feature or request labels Jun 14, 2022
@github-actions
Copy link

Unable to find test scripts. Please add necessary tests to the PR.

@github-actions github-actions bot added the Bug Something isn't working label Jun 14, 2022
@github-actions
Copy link

Unable to find test scripts. Please add necessary tests to the PR.

jsartisan
jsartisan previously approved these changes Jun 14, 2022
@@ -149,7 +150,7 @@ export function* executeActionTriggers(
return response;
}

export function* executeAppAction(payload: ExecuteTriggerPayload) {
export function* executeAppAction(payload: ExecuteTriggerPayload): any {
Copy link
Contributor

Choose a reason for hiding this comment

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

@Rishabh-Rathod can you take a look at this change in this action saga file?

Copy link
Contributor

Choose a reason for hiding this comment

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

@techbhavin i will need some context here about what are we trying to do in this PR and mainly executeAppAction and initiateActionTriggerExecution

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Rishabh-Rathod

here All changes related to the form button widget deprecate replace it with the button widget.
and here change is related below feature refer comment

  • if API action in form widget return success response form should reset.
  • if used had set reset on form success and did not reset if API returns an error.

In initiateActionTriggerExecution all trigger execute form this function and wait till execution complete by executeAppAction
previously executeAppAction was not returning any response.

Copy link
Contributor

@rishabhrathod01 rishabhrathod01 Jun 25, 2022

Choose a reason for hiding this comment

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

Please help me understand below points

Why do we need changes made in executeActionTriggers?

// response return only one object into array
set(response, "0.success", true);

I can notice in executeAppAction, we call evaluateAndExecuteDynamicTrigger which indeed calls executeActionTriggers but it doesn’t return anything. I couldn’t understand where are we consuming the response set above.


Quoting Dilip's message

Today our "reset form on success" field when switched on also resets if there's an error in the API which is incorrect, i believe this could be fixed here.

Would like to understand how do we plan to handle reset of form in below cases.

cc: @dilippitchika

Note we won't be having context of what each API is meant to do in below cases.

  1. If 1st action's is successful and onSuccess of it 2nd action fails.

If for an example, Form's button on submit runs

{{
  Api1.run(() => {  // success
      Api2.run()  // failure
   })
}}

here Api1 was successful but Api2 failed. Do we want to reset for this case?

How do we decide what is success for our users here ?

  1. Multiple updateAction and one of the fails

If for an example, Form's button on submit runs

{{
updateDataInDB1.run(); // success
updateDataInDB2.run(); // failure
updateDataInDB3.run() // success
}}

Do we want to reset for this case?
How do we decide what is success for our users here ?

Copy link
Contributor Author

@techbhavin techbhavin Jun 27, 2022

Choose a reason for hiding this comment

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

@Rishabh-Rathod answering to your questions

  1. Why do we need changes made in executeActionTriggers?

here to handle API execution callback, a response is handled. in almost trigger type, previously nothing was returned and not required to return but as per changes related to API execution, here I change for other types
let response: unknown[] = [{ success: true }];
in the location trigger type

ActionTriggerType.GET_CURRENT_LOCATION
ActionTriggerType.WATCH_CURRENT_LOCATION
ActionTriggerType.STOP_WATCHING_CURRENT_LOCATION

if the action executes successfully, we get current location data as a response for that case setting
set(response, "0.success", true);
if there is an error to get the current location, initiateActionTriggerExecution actions catch block will execute

if not set the success flag into executeActionTriggers, I was not found any other way to decide that executed action
const res: unknown[] = yield call(executeAppAction, action.payload);
( at line 191 ) for which trigger type and how to check API success error callback.

  1. Would like to understand how do we plan to handle the reset of form in the below cases. as per line 198, currently support 1st level trigger if Api1 was successful but Api2 failed. the form will reset as per the current implementation

thanks for giving other possible scenarios. have to create and check that.

Copy link
Contributor

@dilippitchika dilippitchika Jun 29, 2022

Choose a reason for hiding this comment

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

Would like to understand how do we plan to handle reset of form in below cases.

@Rishabh-Rathod i don't think this will ever be foolproof, the user can choose to switch this off and use resetWidget to do it themselves when the 2nd api call succeeds.

@@ -321,6 +351,8 @@ class ButtonWidget extends BaseWidget<ButtonWidgetProps, ButtonWidgetState> {
callback: this.handleActionComplete,
},
});
} else if (this.props.resetFormOnClick && this.props.onReset) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens when onClick is also set and reset form on clicked is also toggled? Which of the actions will take priority? I think it should be resetFormOnClick. But from the code, it seems onClick will take priority. @dilippitchika can confirm on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsartisan , Here

this is handled by callback if there is onClick added, callback always takes care of post actions of onClick which is handled into handleActionComplete function if there is no onClick, and reset on submit enable. it just reset the form.

here onClick should be on priority coz we are dealing with API success error callbacks. so reset should be executed after onClick executed

@jsartisan
Copy link
Contributor

@Rishabh-Rathod there is one change in the action saga file. Can you take a look at that if that change is okay?

@techbhavin
Copy link
Contributor Author

/ok-to-test sha=201e7fe

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/2533171903.
Workflow: Appsmith External Integration Test Workflow.
Commit: 201e7fe.
PR: 14510.

@github-actions
Copy link

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2533171903.
Commit: 201e7fe.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_CATEGORY
scripting 574.24 1850.34 759.05 846.04 621.73 759.05 930.28 56.50 50.53
painting 5.36 6.56 8.38 9.39 7.02 7.02 7.34 21.39 19.21
rendering 271.9 289.02 366.42 376.53 306.85 306.85 322.14 14.54 13.00
BIND_TABLE_DATA
scripting 2317.62 2193.69 2233.02 2824.91 2262.49 2262.49 2366.35 11.00 9.84
painting 11.16 19.05 21.92 27.73 11.94 19.05 18.36 37.91 33.93
rendering 671.96 788.7 898.51 929.37 795.32 795.32 816.77 12.48 11.16
CLICK_ON_TABLE_ROW
scripting 1558.26 1762.6 2052.03 2242.35 1724.73 1762.6 1867.99 14.70 13.15
painting 15.4 13.45 16.91 39.27 11.45 15.4 19.3 58.81 52.59
rendering 269.55 320.42 375 345.91 289.49 320.42 320.07 13.23 11.83
UPDATE_POST_TITLE
scripting 2504.42 3273.44 3461.47 2760.26 2841.51 2841.51 2968.22 13.17 11.78
painting 13.84 23.96 16.53 27.13 22.57 22.57 20.81 26.29 23.55
rendering 390.07 504.78 488.65 442.85 427.61 442.85 450.79 10.31 9.22
OPEN_MODAL
scripting 1112.24 1156.37 1342.58 1309.54 1226.38 1226.38 1229.42 7.96 7.12
painting 16.4 12.66 16.63 14.68 12.37 14.68 14.55 13.81 12.30
rendering 440.37 434.81 590.24 442.72 501.71 442.72 481.97 13.77 12.31
CLOSE_MODAL
scripting 595.6 577.99 948.45 650.18 620.83 620.83 678.61 22.59 20.20
painting 6.4 5.58 7.37 13.43 9.98 7.37 8.55 37.31 33.33
rendering 373.89 421.73 524.3 444.5 419.1 421.73 436.7 12.65 11.32
SELECT_WIDGET_MENU_OPEN
scripting 1585.8 1554.2 1810.27 1440.12 1552.71 1554.2 1588.62 8.54 7.64
painting 7.65 11.61 9.73 14.12 10.08 10.08 10.64 22.56 20.21
rendering 553 639.02 570.03 527.23 585.58 570.03 574.97 7.28 6.51
SELECT_WIDGET_SELECT_OPTION
scripting 255.13 288.6 265.8 244.65 347.17 265.8 280.27 14.55 13.02
painting 5.29 3.77 3.58 2.91 8.23 3.77 4.76 44.75 39.92
rendering 15.84 22.8 19.21 17.31 20.55 19.21 19.14 14.21 12.70

@dilippitchika
Copy link
Contributor

@aswathkk this impacts the property pane for button widget. Can you also check this once?

@aswathkk
Copy link
Contributor

Thanks, @dilippitchika. I will take care of this once we merge this PR to release.

@chandannkumar
Copy link

chandannkumar commented Jul 7, 2022

@techbhavin DP link is broken
cc: @yaldram

@jsartisan jsartisan removed their request for review July 8, 2022 05:08
@chandannkumar
Copy link

@techbhavin
Buttons can be clicked when Disabled Invalid Forms is enabled and also button seems disabled in form
https://www.loom.com/share/03c1da03b57844889cebfbaffeef728c

@techbhavin
Copy link
Contributor Author

/ok-to-test sha=919afbd

@github-actions
Copy link

github-actions bot commented Jul 8, 2022

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/2635841170.
Workflow: Appsmith External Integration Test Workflow.
Commit: 919afbd.
PR: 14510.

@chandannkumar
Copy link

chandannkumar commented Jul 8, 2022

@techbhavin cc: @yaldram
DP link seems broken
image.png

@github-actions
Copy link

github-actions bot commented Jul 8, 2022

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2635841170.
Commit: 919afbd.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_CATEGORY
scripting 573.45 529.24 559.58 538.85 533.92 538.85 547.01 3.43 3.07
painting 5.79 3.82 4.6 3.6 5.37 4.6 4.64 20.47 18.32
rendering 317.1 313.66 310.14 306.52 318.22 313.66 313.13 1.55 1.39
BIND_TABLE_DATA
scripting 2146.13 2272.19 2186.61 2230.31 2145.29 2186.61 2196.11 2.51 2.24
painting 12.22 8.33 11.07 15 9.17 11.07 11.16 23.66 21.15
rendering 734.01 700.93 739.53 717.44 699.11 717.44 718.2 2.57 2.30
CLICK_ON_TABLE_ROW
scripting 1365.4 1265.16 1432.8 1353.78 1407.43 1365.4 1364.91 4.70 4.21
painting 32.65 10.05 14.5 17.51 11.62 14.5 17.27 52.46 46.90
rendering 273.22 274.22 278.51 292.5 285.82 278.51 280.85 2.92 2.61
UPDATE_POST_TITLE
scripting 2083.5 2975.73 2139.17 2612.01 3815.65 2612.01 2725.21 26.08 23.32
painting 16.34 16.72 22.92 13.39 17.54 16.72 17.38 19.97 17.84
rendering 375.44 379.97 373.72 366.84 401.19 375.44 379.43 3.44 3.08
OPEN_MODAL
scripting 892.54 1024.78 1051.89 990.38 1595.15 1024.78 1110.95 24.96 22.33
painting 9.62 10.18 16.4 9 9.62 9.62 10.96 28.01 25.00
rendering 450.35 455.74 462.84 470.85 461.46 461.46 460.25 1.68 1.50
CLOSE_MODAL
scripting 617.56 1089.41 503.78 492.82 621.64 617.56 665.04 36.82 32.94
painting 15.18 4.32 8.94 5.6 9.69 8.94 8.75 48.46 43.31
rendering 428.61 439.77 405.39 392.23 405.09 405.39 414.22 4.68 4.19
SELECT_WIDGET_MENU_OPEN
scripting 1261.99 1290.04 1316.35 1290.44 1276.13 1290.04 1286.99 1.57 1.40
painting 11.99 6.28 11.43 8.88 5.78 8.88 8.87 32.13 28.75
rendering 594.55 594.43 599.24 611.3 594.1 594.55 598.72 1.23 1.10
SELECT_WIDGET_SELECT_OPTION
scripting 172.4 210.41 206.32 281.09 174.34 206.32 208.91 21.07 18.84
painting 2.38 5.3 2.02 3.17 2.01 2.38 2.98 46.31 41.61
rendering 9.63 10.66 10.27 10.52 9.74 10.27 10.16 4.53 4.04

@chandannkumar
Copy link

Tested this PR and working as expected.

  • Tested form button deprecation warning message
  • Tested migration of form button which works fine
  • Tested Button widget functionality in place of Form button
  • Tested Button behavior when added inside form. Form options should be visible
  • Tested Button behavior when added on canvas and not on form. Form options must gets hidden
  • Tested for Button functionality must be same as Form button

@techbhavin
Copy link
Contributor Author

/ok-to-test sha=7d03e0e

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/2690007518.
Workflow: Appsmith External Integration Test Workflow.
Commit: 7d03e0e.
PR: 14510.

@github-actions
Copy link

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2690007518.
Commit: 7d03e0e.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_CATEGORY
scripting 653.36 625.49 612.57 576.22 575.64 612.57 608.66 5.47 4.90
painting 9.76 5.18 4.72 3.83 5.87 5.18 5.87 39.18 34.92
rendering 97.97 98.77 94.68 93.26 93.36 94.68 95.61 2.72 2.43
BIND_TABLE_DATA
scripting 2354.43 2259.35 2269.88 2188.31 2232.28 2259.35 2260.85 2.70 2.42
painting 18.24 6.72 11.75 12.5 11.01 11.75 12.04 34.30 30.65
rendering 768.37 709.03 717.82 694.46 690.22 709.03 715.98 4.37 3.91
CLICK_ON_TABLE_ROW
scripting 1352.4 1454.81 1433.66 1667.27 1370.43 1433.66 1455.71 8.63 7.72
painting 14.6 10.25 9.88 10.95 9.4 10.25 11.02 18.87 16.88
rendering 289.58 299.88 311.83 282.63 290.2 290.2 294.82 3.84 3.43
UPDATE_POST_TITLE
scripting 2808.23 2470.72 2533.01 2509.3 3078 2533.01 2679.85 9.68 8.66
painting 18.26 14.03 14.62 15.15 12.99 14.62 15.01 13.26 11.86
rendering 441.53 414.55 405.18 399.22 402.52 405.18 412.6 4.16 3.72
OPEN_MODAL
scripting 1106.16 1062.86 972.74 987.41 1002.04 1002.04 1026.24 5.49 4.91
painting 11.2 16.05 21.6 15.3 14.38 15.3 15.71 24.06 21.51
rendering 377.92 387.32 346.32 348.95 352.04 352.04 362.51 5.18 4.63
CLOSE_MODAL
scripting 634.22 585.99 568.08 558.49 556 568.08 580.56 5.55 4.97
painting 6.05 8.24 4.75 4.79 5.33 5.33 5.83 24.87 22.13
rendering 542.02 524.55 502.87 503.03 514.86 514.86 517.47 3.18 2.84
SELECT_WIDGET_MENU_OPEN
scripting 1141.98 1151.58 1122.44 1164.61 1204.57 1151.58 1157.04 2.65 2.37
painting 6.42 5.86 7.56 8.57 6.91 6.91 7.06 14.87 13.31
rendering 591.99 618.21 602.5 606.62 639.46 606.62 611.76 2.96 2.65
SELECT_WIDGET_SELECT_OPTION
scripting 164.23 161.43 153.95 198.22 169.92 164.23 169.55 10.04 8.98
painting 2.8 2.64 3.54 17.89 7.2 3.54 6.81 94.86 84.88
rendering 11.04 14.68 11.99 17.03 13.33 13.33 13.61 17.27 15.43

@techbhavin
Copy link
Contributor Author

/ok-to-test sha=0ab16cc

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/2716660505.
Workflow: Appsmith External Integration Test Workflow.
Commit: 0ab16cc.
PR: 14510.

@techbhavin techbhavin enabled auto-merge (squash) July 22, 2022 06:29
@github-actions
Copy link

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2716660505.
Commit: 0ab16cc.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_CATEGORY
scripting 590.04 592.59 579.41 572.53 585.56 585.56 584.03 1.39 1.25
painting 3.77 5.79 3.81 4.48 4.69 4.48 4.51 18.18 16.41
rendering 96.17 95.57 94.64 95.36 95.17 95.36 95.38 0.59 0.52
BIND_TABLE_DATA
scripting 2212.43 2276.42 2228.53 2372.5 2280.19 2276.42 2274.01 2.75 2.46
painting 13.69 15.91 12.87 15 10.16 13.69 13.53 16.41 14.63
rendering 716.73 701.51 686.56 714.45 705.07 705.07 704.86 1.71 1.53
CLICK_ON_TABLE_ROW
scripting 1303.39 1330.1 1631.37 1304.05 1291.65 1304.05 1372.11 10.61 9.49
painting 10.34 9.85 9.21 9.59 9.53 9.59 9.7 4.33 3.92
rendering 293.42 299.27 284.43 280.75 284.83 284.83 288.54 2.63 2.35
UPDATE_POST_TITLE
scripting 2551.87 2502.32 2266.27 2322 2543.72 2502.32 2437.24 5.48 4.90
painting 14.51 16.34 13.66 17.9 18.86 16.34 16.25 13.54 12.06
rendering 411.55 398.91 396.02 397.77 406.21 398.91 402.09 1.63 1.46
OPEN_MODAL
scripting 809.62 802.36 815.27 797.14 827.29 809.62 810.34 1.45 1.29
painting 10.08 10.54 9.18 12.83 11.41 10.54 10.81 12.86 11.47
rendering 327.09 317.3 326.62 315.48 321 321 321.5 1.64 1.47
CLOSE_MODAL
scripting 486.46 434.12 486.88 484.11 738.5 486.46 526.01 22.98 20.55
painting 5.58 4.22 4.45 5.23 6.22 5.23 5.14 15.95 14.20
rendering 492.67 463.57 465.5 474.7 473.97 473.97 474.08 2.43 2.17
SELECT_WIDGET_MENU_OPEN
scripting 1108.19 1082.71 1102.78 1132.14 1139.16 1108.19 1113 2.06 1.84
painting 8.05 5.1 7.29 5.57 6.91 6.91 6.58 18.54 16.57
rendering 482.75 475.37 492.53 498.06 497.51 492.53 489.24 2.02 1.81
SELECT_WIDGET_SELECT_OPTION
scripting 160.58 165.56 152.59 158.17 157.12 158.17 158.8 3.00 2.68
painting 3.47 3.64 2.59 5.44 3.9 3.64 3.81 27.30 24.41
rendering 10.89 11.39 10.46 10.44 11.08 10.89 10.85 3.78 3.41

@techbhavin techbhavin merged commit f45a155 into release Jul 22, 2022
@techbhavin techbhavin deleted the fix/issue-3613 branch July 22, 2022 08:27
tanvibhakta pushed a commit that referenced this pull request Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Enhancement New feature or request Form Widget Widgets Product This label groups issues related to widgets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]-[800]:Deprecate form button widget
9 participants