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

feat: updated widget meta key reset logic #7901

Merged
merged 2 commits into from
Oct 9, 2021

Conversation

techbhavin
Copy link
Contributor

@techbhavin techbhavin commented Sep 28, 2021

Clear file picker's previous file uploads on reset widget

Fixes #6124

Fixes #743

Type of change

  • Bugfix (non-breaking change which fixes an issue)

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

Test coverage results 🧪

🔴 Total coverage has decreased
// Code coverage diff between base branch:release and head branch: fix/filepicker-clear-file-onreset 
Status File % Stmts % Branch % Funcs % Lines
🔴 total 54.81 (-0.01) 36.81 (-0.01) 33.89 (0) 55.41 (0)
🔴 app/client/src/widgets/FilePickerWidgetV2/widget/index.tsx 33.33 (-1.32) 0 (0) 20.69 (0) 34.34 (-0.71)

@github-actions github-actions bot added the Enhancement New feature or request label Sep 28, 2021
prevProps.selectedFiles &&
prevProps.selectedFiles.length > 0 &&
this.props.selectedFiles === undefined
size(prevProps.selectedFiles) > 0 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we expect the selected-files to be anything other than array?

Copy link
Contributor Author

@techbhavin techbhavin Sep 30, 2021

Choose a reason for hiding this comment

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

yes, here in any other cases like undefined or null rather than array is handle by size function of lodash and return 0

@SatishGandham

Copy link
Contributor

Choose a reason for hiding this comment

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

How about doing const {selectedFiles=[]}=this.props?

@vivekverma2312
Copy link

@techbhavin Tested and working on deploy preview.

@techbhavin techbhavin merged commit 22acbe4 into release Oct 9, 2021
@techbhavin techbhavin deleted the fix/filepicker-clear-file-onreset branch October 9, 2021 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
4 participants