fix(AlertReportModal): Text Area Change#17176
Conversation
superset-frontend/src/explore/components/controls/TextAreaControl.jsx
Outdated
Show resolved
Hide resolved
superset-frontend/src/explore/components/controls/TextAreaControl.jsx
Outdated
Show resolved
Hide resolved
|
@AAfghahi I would like to get the test env up. Please let me know when the CI passes. Thank you |
0e00ba3 to
a35059e
Compare
|
@geido |
Codecov Report
@@ Coverage Diff @@
## master #17176 +/- ##
==========================================
+ Coverage 76.95% 77.03% +0.07%
==========================================
Files 1038 1037 -1
Lines 55612 55621 +9
Branches 7590 7594 +4
==========================================
+ Hits 42798 42845 +47
+ Misses 12564 12526 -38
Partials 250 250
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
/testenv up |
|
@eschutho Ephemeral environment spinning up at http://52.41.148.26:8080. Credentials are |
|
In general it's preferable to always add debounce to text inputs because even if they don't trigger remote API calls, they could still trigger expensive re-rendering. Not sure if this will work, but an alternative solution here could be to re-render the modal completely when users go to a new report, which can probably be achieved by setting a uniq |
a35059e to
1c84645
Compare
3fd8b61 to
0b4a49f
Compare
0b4a49f to
973cfda
Compare
|
@ktmud Hey! So I followed your advice and added a key to the AlertReportModal which really helped thank you for that! I ended up not doing the key to the TextAreaControl and instead put it on the entire modal. Regarding your point on the debouncer, doing some research I found that the react-ace editor has its own internal state for value and also has a built in debouncer, so I made the component into an uncontrolled component (though it still spreads props so the other places that use it will still be able to pass in value). This did require us to bump up react-ace because our current version had a known bug that finished. One thing to note is that this does drop bracejs as a dependency, but we have bracejs in our package.json so I don't think it will affect us in that way. |
e3f7e07 to
294ce97
Compare
superset-frontend/src/SqlLab/components/TemplateParamsEditor/TemplateParamsEditor.test.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
this looks like it will never change value if you type in it?
There was a problem hiding this comment.
does this generate a new key each time it rerenders?
There was a problem hiding this comment.
yes, and I actually moved it over to the AlertReportModal because of this. Earlier I had done this and the state issue had still persisted, but when I test it now it is working fine. So I must have originally tested it during a bad iteration.
2be1623 to
25da0b1
Compare
There was a problem hiding this comment.
There was a bug that I fixed on sql lab where if you passed in value as null (not undefined), sql lab would crash. Can you test to see if this was fixed with the new version of aceeditor?
eschutho
left a comment
There was a problem hiding this comment.
This look really good. Just a few small questions since this component is used throughout the app.
|
/testenv up FEATURE_ALERT_REPORTS=true |
|
@eschutho Ephemeral environment spinning up at http://54.218.96.39:8080. Credentials are |
|
@AAfghahi @eschutho I'm not sure if this is related to this fix, I found that I no longer able to see the query on the virtual dataset after this code change. Steps:
sql.editor.of.dataset.movI tested on other Ephemeral env and do not reproduce this, so I suspect it is caused by this PR. ✅ regression test creating new alert, edit alert sql editor field not overwrites |
|
/testenv up ENABLE_TEMPLATE_PROCESSING=True FEATURE_ALERT_REPORTS=true |
Thanks @rosemarie-chiu! Nice catch... We'll take a look. |
|
@eschutho Ephemeral environment spinning up at http://54.218.248.191:8080. Credentials are |
25da0b1 to
5bab212
Compare
|
@rosemarie-chiu you're amazing thank you! I made a change that catches that instance. |
|
/testenv up ENABLE_TEMPLATE_PROCESSING=True FEATURE_ALERT_REPORTS=true |
|
@eschutho Ephemeral environment spinning up at http://54.213.225.219:8080. Credentials are |
|
Ephemeral environment shutdown and build artifacts deleted. |
* Text Area Change * added unique key to component * tests passing * changed css * data flow and naming convention (cherry picked from commit 5948a9f)
* Text Area Change * added unique key to component * tests passing * changed css * data flow and naming convention
|
I wonder why to remove 'props.value' from TextArea, which should always render the value be given. |

SUMMARY
There was an error report where users were reporting that sql values that they were inputting into the TextAreaControl section would linger even when they closed out and went to a new report, or even created a new report. This was because we were storing the sql in state, but not clearing state when a modal was closed.
This state was created to stop cursor errors here: #15820. I believe that @geido made this change.
The cursor errors were occurring because we added a debouncer to the ace-editor here: #10837
In investigating this, I was wondering why we had a debouncer for the ace editor to begin with? The input is not using an API, and looking through the different places where TextAreaControl is used, none of them make an API call. So this PR deletes the debouncer, which fixes both the cursor back issue and also gets rid of the state.value //prop.value difference.
However, I wanted to make sure that getting rid of this debouncer is fine @ktmud and @geido ? Where are the places that we should check to make sure?
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
CleanShot.2021-10-06.at.11.24.23.mp4
After:
https://user-images.githubusercontent.com/48933336/138182251-f5d5dfc0-c7dc-4066-a39a-b1b2b1b0cffd.mov
TESTING INSTRUCTIONS
Create an alert, exit out. Create another alert, there should not be any sql in the sql input form.
ADDITIONAL INFORMATION