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: update svgr webpack config to use svg dimensions #24747

Merged

Conversation

eschutho
Copy link
Member

@eschutho eschutho commented Jul 19, 2023

SUMMARY

This fix from a breaking change/regression after bumping the svgr/webpack package enables us to continue to use the width/height dimensions from the svg image itself. Ref: https://react-svgr.com/docs/options/#icon

Changes: https://github.com/apache/superset/pull/24648/files#diff-3834c36280e1af5685801f3357578aaec5a110699a2b8eb97844c56b4400c091

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:
Preset
Screenshot_7_19_23__11_15_AM

After:
_DEV__Superset
Screenshot_7_19_23__11_13_AM

TESTING INSTRUCTIONS

Load a chart with icons. There may be other places in the application that were affected that haven't yet been identified, but by doing a code search for svg images with width and height we should be able to find others.

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

@eschutho eschutho mentioned this pull request Jul 19, 2023
3 tasks
@eschutho eschutho force-pushed the elizabeth/update-svgr-webpack-config branch 2 times, most recently from 22913f6 to d764f79 Compare July 19, 2023 21:21
@eschutho eschutho force-pushed the elizabeth/update-svgr-webpack-config branch from d764f79 to 184ffd1 Compare July 19, 2023 21:23
@eschutho
Copy link
Member Author

/testenv up

@github-actions
Copy link
Contributor

@eschutho Container image not yet published for this PR. Please try again when build is complete.

@github-actions
Copy link
Contributor

@eschutho Ephemeral environment creation failed. Please check the Actions logs for details.

@eschutho
Copy link
Member Author

/testenv up

@github-actions
Copy link
Contributor

@eschutho Ephemeral environment spinning up at http://34.222.110.123:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@codecov
Copy link

codecov bot commented Jul 19, 2023

Codecov Report

Merging #24747 (09a1982) into master (5878c11) will decrease coverage by 1.66%.
The diff coverage is 68.84%.

❗ Current head 09a1982 differs from pull request most recent head a80b38c. Consider uploading reports for the commit a80b38c to get more accurate results

@@            Coverage Diff             @@
##           master   #24747      +/-   ##
==========================================
- Coverage   68.89%   67.23%   -1.66%     
==========================================
  Files        1901     1902       +1     
  Lines       73925    73939      +14     
  Branches     8183     8176       -7     
==========================================
- Hits        50931    49716    -1215     
- Misses      20873    22110    +1237     
+ Partials     2121     2113       -8     
Flag Coverage Δ
javascript 55.76% <59.25%> (+0.04%) ⬆️
unit ?

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

Impacted Files Coverage Δ
...src/components/ColumnTypeLabel/ColumnTypeLabel.tsx 100.00% <ø> (ø)
...d/packages/superset-ui-chart-controls/src/index.ts 100.00% <ø> (ø)
...-chart-controls/src/sections/advancedAnalytics.tsx 14.28% <ø> (ø)
...rset-ui-chart-controls/src/sections/chartTitle.tsx 100.00% <ø> (ø)
...legacy-plugin-chart-partition/src/controlPanel.tsx 25.00% <ø> (ø)
...gins/legacy-plugin-chart-rose/src/controlPanel.tsx 50.00% <ø> (ø)
...gins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx 100.00% <ø> (ø)
.../BigNumber/BigNumberWithTrendline/controlPanel.tsx 16.66% <ø> (ø)
...s/plugin-chart-echarts/src/Funnel/controlPanel.tsx 66.66% <ø> (ø)
...ns/plugin-chart-echarts/src/Gauge/controlPanel.tsx 66.66% <ø> (ø)
... and 43 more

... and 97 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@john-bodley
Copy link
Member

@eschutho do you see #24740? It seems @mistercrunch had an alternative formulation.

@@ -419,11 +419,6 @@ const config = {
{
loader: '@svgr/webpack',
options: {
icon: true,
Copy link
Member

Choose a reason for hiding this comment

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

are the defaults good? do we want to be explicit as in

options: {
  // making sure that svgo isn't setting width:1em
  icon: false,
  // don't allow svgo to alter/opitmize the svg 
  svgo: false,
},

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, good idea. The default for svgo is actually true and I don't think it will break anything in this use case if changed to false, but I'll add in the default for icon with a comment.

@eschutho
Copy link
Member Author

@eschutho do you see #24740? It seems @mistercrunch had an alternative formulation.

Thanks @john-bodley, yeah I saw @mistercrunch's PR as well. This PR just reverts the functionality back to the original behavior where it does not override the width/height if it's in the svg file. @mistercrunch, @rusackas and I talked a bit offline about what the long-term behavior should be and agreed that we'll merge both PRs with the idea that if you wanted to use height/width in the svg that it should render in the html, or if you want to override the values with css, you can do that as well.

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

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

LGTM!

@eschutho eschutho merged commit f856ba2 into apache:master Jul 21, 2023
26 checks passed
@eschutho eschutho deleted the elizabeth/update-svgr-webpack-config branch July 21, 2023 21:48
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

@michael-s-molina michael-s-molina added the v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch label Jul 24, 2023
jinghua-qa pushed a commit to preset-io/superset that referenced this pull request Jul 24, 2023
@mistercrunch mistercrunch added 🍒 3.0.1 🍒 3.0.2 🍒 3.0.3 🍒 3.0.4 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 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 preset:2023.29 size/XS v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch 🍒 3.0.0 🍒 3.0.1 🍒 3.0.2 🍒 3.0.3 🍒 3.0.4 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants