Skip to content

feat(emotion): Upgrade emotion to v10 #15106

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

Merged
merged 21 commits into from
Jan 10, 2020
Merged

Conversation

billyvg
Copy link
Member

@billyvg billyvg commented Oct 16, 2019

Read the migration log for more information.

From their migration guide...

The most significant change in Emotion 10 is that it doesn’t let you easily access the underlying class names. Instead of thinking in class names, you have to think in terms of styles and composing them together (you can still use class names directly if you want to, but you won’t get new features like zero-config server rendering).
For example, in Emotion 9, you might have had two classes from css and compose them together with cx, but in Emotion 10, you create two styles and compose them together in the css prop like this:

Take a look at this diff for an example.

grid-emotion

We are still deprecating this, but in the meantime we are upgrading to reflexbox so that we can push forward with the emotion upgrade without having to refactor all of grids out.

Build times

No measurements yet Roughly 9.8% increase in build time. We may be able to mitigate impact on incremental builds a bit by forking the type checking (although this will not help with your energy bill): #15587

This is the tsc --diagnostics comparison

master

Files:           995
Lines:        466265
Nodes:        820647
Identifiers:  274490
Symbols:      618451
Types:        207662
Memory used: 703338K
I/O read:      0.21s
I/O write:     0.25s
Parse time:    2.41s
Bind time:     0.73s
Check time:   13.54s
Emit time:     2.44s
Total time:   19.12s

Emotion 10

Files:          1002
Lines:        466702
Nodes:        822659
Identifiers:  275206
Symbols:      697918
Types:        582946
Memory used: 994339K
I/O read:      0.20s
I/O write:     0.26s
Parse time:    2.56s
Bind time:     0.90s
Check time:   30.12s
Emit time:     2.43s
Total time:   36.01s

Bundle sizes

Roughly 1.8% increase in filesize (gzipped).

TODO

@billyvg billyvg force-pushed the feat/emotion/upgrade-to-emotion-10 branch 2 times, most recently from c48ec2e to 5a91665 Compare October 16, 2019 20:38
@billyvg billyvg force-pushed the feat/emotion/upgrade-to-emotion-10 branch 9 times, most recently from 64c278e to 18acd5b Compare December 7, 2019 19:15
@billyvg billyvg force-pushed the feat/emotion/upgrade-to-emotion-10 branch 3 times, most recently from af17963 to b425f26 Compare December 13, 2019 00:21
@billyvg billyvg force-pushed the feat/emotion/upgrade-to-emotion-10 branch 12 times, most recently from 3544bb2 to caab6df Compare January 5, 2020 23:23
@billyvg billyvg changed the title feat(emotion): Upgrade emotion to v10 [WIP] feat(emotion): Upgrade emotion to v10 Jan 5, 2020
@billyvg billyvg force-pushed the feat/emotion/upgrade-to-emotion-10 branch 3 times, most recently from f8f6ded to 4086619 Compare January 6, 2020 19:52
We generally use the `classnames` library to handle merging/dynamic `className`. No reason to use two different libraries.
…add eslint rules for emotion, update babel plugin
@billyvg billyvg force-pushed the feat/emotion/upgrade-to-emotion-10 branch from 9dabfd1 to c539551 Compare January 10, 2020 20:25
@billyvg billyvg merged commit 94a63d9 into master Jan 10, 2020
@billyvg billyvg deleted the feat/emotion/upgrade-to-emotion-10 branch January 10, 2020 21:09
billyvg added a commit to getsentry/eslint-config-sentry that referenced this pull request Jan 10, 2020
`grid-emotion` has been deprecated for quite awhile, and reflexbox is the updated and maintained version of it.

We updated the library while upgrading `emotion` here: getsentry/sentry#15106
matejminar added a commit that referenced this pull request Jan 13, 2020
* ref(ts): Convert <SidebarOrgSummary> to typescript

* comment

* fix: Use django's is_safe_url function (#16337)

The implementation of this function from django 1.9.13 covers more invalid URLs
than the one from django-sudo does. We should not redirect to
`http:123347` style URLs.

* fix(ui) Fix gravatar fallbacks (#16336)

When updating Gravatar to typescript, I removed some property spreads as
they triggered typescript warnings and the propTypes didn't cover any
props that needed spreading. The onLoad and onError props were load
bearing as they are used to handle gravatar fallbacks.

* Removing unused class (#16278)

* fix(discover) - Show errors if we encounter them loading discover

- Shows a permission error if a user without access to events like a
  billing account tries to access discover

* feat(discover) Switch trace and span id to use columns instead of context

Have the trace_id and span_id use the built in columns instead of the context
array.

* fix(ui): Fix <ContextPickerModal> and refactor to ts (#16090)

This removes `LatestContext` dependency and fixes `ContextPickerModal` and refactors it to ts.

Co-Authored-By: Matej Minar <[email protected]>

* fix(ui): Fix redirect after creating/editing Metric Alert rules (#16342)

Also makes sure that the index redirects to combined alert listing view.

* ref(perf) Attempt to improve performance of facets endpoint (#16359)

* Fetch tag values individually. This will let snuba use the promoted
  columns more effectively as they perform better.
* Only get 10 facets by default.
* Use a having clause instead of WHERE to exclude tracing tags as it
  performs better.
* Don't use fields that unpack into arrayJoin() expressions where
  possible.
* Enable sampling at lower project thresholds, as we don't need full
  accuracy.

* fix(saml2): Improve error message on attribute mapping (#16347)

* ref: Remove SnubaEvent (#16309)

Remove SnubaEvent since we are moving towards a single event model
(eventstore/models/Event) everywhere.

* fix(tasks) Add event data to user report asynchronously

If an event hasn't been propagated when the user report is created, then queue a
task to sync the event data once it's stored fully.

* feat(django): pytest startup and test collection on Django 1.11 (#16105)

* chore: cleanup bitfield (#16031)

* fix(migrations): Make Snuba event migration more robust (#16364)

Fixes getsentry/self-hosted#322

* feat(teams): Update open membership team permissions (#16244)

* fix(migrations): Fix prerequisite for jira_ac migration (#16351)


Fixes getsentry/self-hosted#332

* fix(auth): Correct path used for SSO errors (#16315)

The route for sentry-organization-auth-settings was still located in the
old settings path, this route is used for a redirect in the auth.helper
module when there is a problem configuring SSO.

This just corrects the redirect so it goes back to settings instead of
404ing.

* fix: Remove beta tag on PagerDuty integration (#16344)

* fix(tagstore) Don't explode on null values (#16368)

The `sentry:user` tag can come back null when it is read from the
promoted columns. Handling nulls allows get_tag_value_label() to be used
more broadly.

* ref: Remove now unused discover query code (#16306)

Remove the automatic dataset detection logic from sentry. We have
switched over to the snuba based implementation of this. Not having
dataset selection in sentry also means we can remove some (but not all)
of the supporting logic as well.

* feat(ui): Require `org:write` role for Metric Alerts form (#16340)

This disables all form fields when editing a Metric Alert without the `org:write` role.

* ref(ts) Move BadgeDisplayName to typescript (#16361)

* test: fix remaining Django 1.11 tests and make required (#16367)

* fix(saml): Wrap individual idp config tabs with forms (#16373)

* chore(django 1.11): bump django-crispy-forms to 1.7.2 (#16371)

* translation+pluralization

* removed duplicate style

* removed duplicate style

* fix(ui): Fixed alignment in <TogglableAddress> if it cannot be converted to relative (#16385)

* ref(discover2) Test out sampling on tag values (#16387)

The facets endpoint is still not fast. I want to see what kind of
results can be obtained if we aggressively sample tag values. If this
yields acceptable performance I want to try scaling the sampling rate
based on the data volume so that we can better balance accurracy and
performance.

* test(acceptance): Try #2 to fix flakey onboarding test for dja… (#16345)

Try #2, use a timed retry policy

* fix(discover2): Fix Percy snapshots and UX issues on Querybuilder (#16291)

* fix(discover2): Test fix on Percy snapshots
* fix(discover2): Improve QueryBuilder for error/loading states
* fix(discover2): Resize QueryBuilder when browser is resized

* feat: Register option for eventstream (#16363)

Register option for #16285

* feat(alerts): Remove "Related issues" from incidents (#16379)

This removes the UI components that fetch and render related issues on the Incidents details view.

* ref: Deprecate get_legacy_message (#16310)

Move the implementation into the Pagerduty plugin since this is the only
place it is used.

* feat(tracing) Add spans for snuba queries (#16388)

Add spans to collect more information about snuba queries. Having the
referrer and the start of the query body should make tracking down slow
queries in snuba easier as we have more context.

* feat(workflow): Remove "Create incident" manual workflow and e… (#16375)

This removes the UI and endpoint to create a manual incident.

* feat: upgrade drf to 3.6.4 (#16392)

* feat(alerts): Remove "Suspects" UI and endpoint (#16378)

This was used on the Incidents details view, but is no longer used

* ref(discover) Remove the raw field (#16390)

Outputting the raw data when we also output all the formatted keys
wastes space and adds visual noise.

* fix(discover2): Use transaction root span only if there are no descendent spans for the ops breakdown (#16377)

* feat(emotion): Upgrade emotion to v10 (#15106)

* ref(ui): Refactor `cx` from emotion to `classnames`

We generally use the `classnames` library to handle merging/dynamic `className`. No reason to use two different libraries.

* upgrade emotion, add styled wrapper for typings (and related paths), add eslint rules for emotion, update babel plugin

* Refactor usage of emotion `css` being treated as a class name string

* change innerRef --> ref

* refactor grid-emotion props and update to `reflexbox`

* eslint for emotion-setup

* refactor injectGlobal --> Global for emotion upgrade

* Add <CacheProvider>, this is needed to turn speedy off for percy

* refactor <HeaderItem> - fix missing props to styled components, remove innerRef and forwardRef

* Change <Tooltip> logic for when to apply a wrapper, emotion causes the previously expected types to be different

* random TS fixes for styled components

* fix <RadioGroup> animation needing `css`

* forwardRef for Switch

* define a `theme.space` for rebass/grid

* fix DOM attribute warnings with "loading" prop

* fix settings breadcrumb - Box in `reflexbox` has different CSS than grid-emotion

* change <ProviderRow> to remove `Flex` around CircleIndicator as it was squishing it on small widths

* css fixes for percy

* fix featureDisabled logic for custom alerts because emotion

* refactor emotion9 --> emotion10 (imports)

* update snapshots and fix tests

* feat(drf): Add CamelSnakeSerializer (#16397)

* docs(workflow): Fix link to screenshots in README.md (#16404)

Fixes links to screenshots in README.md broken by 983c8c6

* ref(ts): Convert <QueryCount> to typescript (#16356)

* ref(ts): Convert <SearchBar> to typescript (#16357)

* ref(ts): Convert <SearchBar> to typescript

* removed proptypes, placeholder optional

* ref(ts): Convert getOnboardingTasks to typescript (#16348)

* merge

Co-authored-by: Mark Story <[email protected]>
Co-authored-by: Chris Fuller <[email protected]>
Co-authored-by: William Mak <[email protected]>
Co-authored-by: evanh <[email protected]>
Co-authored-by: Billy Vong <[email protected]>
Co-authored-by: Evan Purkhiser <[email protected]>
Co-authored-by: Lyn Nagara <[email protected]>
Co-authored-by: josh <[email protected]>
Co-authored-by: Burak Yigit Kaya <[email protected]>
Co-authored-by: Megan Heskett <[email protected]>
Co-authored-by: NisanthanNanthakumar <[email protected]>
Co-authored-by: Danny Lee <[email protected]>
Co-authored-by: Alberto Leal <[email protected]>
Co-authored-by: Aakash Kambuj <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants