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: Select refactoring known issues #16666

Merged
merged 22 commits into from
Sep 14, 2021
Merged

fix: Select refactoring known issues #16666

merged 22 commits into from
Sep 14, 2021

Conversation

geido
Copy link
Member

@geido geido commented Sep 10, 2021

SUMMARY

The goal of this PR is to solve the known issues of the new Antd-based Select component, as follows:

  • When showSearch is ON and labels are customized with JSX, the Select can only search by value. For instance, Explore - Customise - COLOR SCHEME - Search for airbnb - won’t work - Will only work with searching bnb as the value used is bnbColors
  • When using labels with custom JSX the rendered HTML is showing label=[Object, Object]
  • Write a string, then delete it entirely. The string is still there and selected
  • With allowNewOptions true, type a non-existent option, then delete it char by char. Not the entire string is deleted.
  • When trying to create a new option, but the search is returning matching options, you won’t be able to create the new option, as the Select will instead pick the first matching option

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@michael-s-molina michael-s-molina changed the title Fix/select refactoring known issues fix: select refactoring known issues Sep 13, 2021
@geido geido changed the title fix: select refactoring known issues fix: Select refactoring known issues Sep 13, 2021
@geido geido marked this pull request as ready for review September 13, 2021 13:45
superset-frontend/src/components/Select/Select.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/Select/Select.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/Select/Select.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/Select/Select.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/Select/Select.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/Select/Select.tsx Outdated Show resolved Hide resolved
geido and others added 4 commits September 13, 2021 19:11
Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Sep 13, 2021

Codecov Report

Merging #16666 (f01d3cf) into master (5ac8ac0) will increase coverage by 0.01%.
The diff coverage is 91.25%.

❗ Current head f01d3cf differs from pull request most recent head f9c0367. Consider uploading reports for the commit f9c0367 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16666      +/-   ##
==========================================
+ Coverage   76.93%   76.95%   +0.01%     
==========================================
  Files        1007     1007              
  Lines       54112    54129      +17     
  Branches     7346     7366      +20     
==========================================
+ Hits        41633    41653      +20     
+ Misses      12239    12236       -3     
  Partials      240      240              
Flag Coverage Δ
javascript 71.28% <91.25%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ntend/src/explore/components/ExploreChartPanel.jsx 14.28% <0.00%> (-0.72%) ⬇️
...perset-frontend/src/addSlice/AddSliceContainer.tsx 60.00% <50.00%> (+3.07%) ⬆️
superset-frontend/src/components/Select/Select.tsx 91.66% <97.05%> (+1.70%) ⬆️
superset-frontend/src/components/Select/utils.ts 96.15% <100.00%> (ø)
...onfigModal/FiltersConfigForm/FiltersConfigForm.tsx 73.27% <100.00%> (+0.07%) ⬆️
...nd/src/explore/components/DataTablesPane/index.tsx 75.49% <100.00%> (+0.24%) ⬆️
...explore/components/controls/ColorSchemeControl.jsx 89.28% <100.00%> (+0.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5ac8ac0...f9c0367. Read the comment docs.

setSelectValue(value);
}, [value]);

useEffect(() => {
Copy link
Member

Choose a reason for hiding this comment

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

Should we only add a new option if allowNewOptions is true? Currently is adding even if allowNewOptions is false. If we do this, what will happen when allowNewOptions is false and an unknown value is passed? Should we discard it and override the selectedValue?

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe it makes sense to keep it when allowNewOptions is both false and true. I don't see the danger in doing that but I see the danger in discarding a value. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Agreed

Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the fixes!

@geido geido merged commit fecd412 into apache:master Sep 14, 2021
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
* Clean up and reorganize effects

* Enhance optionFilterProps

* Render custom label

* Remove prop filtering

* Create options

* Create option from value in single mode

* Change to customLabel

* Show search by default

* Update superset-frontend/src/components/Select/Select.tsx

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>

* Update superset-frontend/src/components/Select/Select.tsx

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>

* Update superset-frontend/src/components/Select/Select.tsx

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>

* Apply minor changes

* Fixes a bug that was failing CI

* Adds more tests to the component

* Apply customLabel in ColorSchemeControl

* Remove customLabel from rendered Option

* Hide No data when allowNewOptions

* Remove unnecessary prop from tests

* Adjust loading height

* Show no data with fetchOnlyOnSearch

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
Co-authored-by: Michael S. Molina <michael.s.molina@gmail.com>
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
* Clean up and reorganize effects

* Enhance optionFilterProps

* Render custom label

* Remove prop filtering

* Create options

* Create option from value in single mode

* Change to customLabel

* Show search by default

* Update superset-frontend/src/components/Select/Select.tsx

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>

* Update superset-frontend/src/components/Select/Select.tsx

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>

* Update superset-frontend/src/components/Select/Select.tsx

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>

* Apply minor changes

* Fixes a bug that was failing CI

* Adds more tests to the component

* Apply customLabel in ColorSchemeControl

* Remove customLabel from rendered Option

* Hide No data when allowNewOptions

* Remove unnecessary prop from tests

* Adjust loading height

* Show no data with fetchOnlyOnSearch

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
Co-authored-by: Michael S. Molina <michael.s.molina@gmail.com>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants