Skip to content

Commit 6158389

Browse files
authored
Drop hoist-non-react-statics (#3290)
* Drop `hoist-non-react-statics` * update lockfile
1 parent 61fcc80 commit 6158389

File tree

7 files changed

+12
-92
lines changed

7 files changed

+12
-92
lines changed

.changeset/tame-pets-flash.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@emotion/react': major
3+
---
4+
5+
`withTheme` will no longer automatically hoist non-React statics onto the created component

packages/react/__tests__/with-theme.js

-14
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,6 @@ test('withTheme works', () => {
2020
).toMatchSnapshot()
2121
})
2222

23-
test(`withTheme(Comp) hoists non-react static class properties`, () => {
24-
class ExampleComponent extends React.Component {
25-
static displayName = 'foo'
26-
static someSpecialStatic = 'bar'
27-
}
28-
29-
const ComponentWithTheme = withTheme(ExampleComponent)
30-
31-
expect(ComponentWithTheme.displayName).toBe('WithTheme(foo)')
32-
expect(ComponentWithTheme.someSpecialStatic).toBe(
33-
ExampleComponent.someSpecialStatic
34-
)
35-
})
36-
3723
test.skip('should forward the ref', () => {
3824
function SomeComponent(props) {
3925
return <div ref={props.ref}>{props.theme.color}</div>

packages/react/package.json

+2-59
Original file line numberDiff line numberDiff line change
@@ -113,60 +113,6 @@
113113
"import": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.mjs",
114114
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js"
115115
},
116-
"./_isolated-hnrs": {
117-
"types": {
118-
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.mjs",
119-
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js"
120-
},
121-
"development": {
122-
"edge-light": {
123-
"module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.esm.js",
124-
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.mjs",
125-
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.js"
126-
},
127-
"worker": {
128-
"module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.esm.js",
129-
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.mjs",
130-
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.js"
131-
},
132-
"workerd": {
133-
"module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.esm.js",
134-
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.mjs",
135-
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.js"
136-
},
137-
"browser": {
138-
"module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.esm.js",
139-
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.cjs.mjs",
140-
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.cjs.js"
141-
},
142-
"module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.esm.js",
143-
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.cjs.mjs",
144-
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.cjs.js"
145-
},
146-
"edge-light": {
147-
"module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.esm.js",
148-
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.mjs",
149-
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.js"
150-
},
151-
"worker": {
152-
"module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.esm.js",
153-
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.mjs",
154-
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.js"
155-
},
156-
"workerd": {
157-
"module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.esm.js",
158-
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.mjs",
159-
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.js"
160-
},
161-
"browser": {
162-
"module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js",
163-
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.cjs.mjs",
164-
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.cjs.js"
165-
},
166-
"module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js",
167-
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.mjs",
168-
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js"
169-
},
170116
"./jsx-dev-runtime": {
171117
"types": {
172118
"import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs",
@@ -266,8 +212,7 @@
266212
"@emotion/serialize": "^1.3.3",
267213
"@emotion/use-insertion-effect-with-fallbacks": "^1.2.0",
268214
"@emotion/utils": "^1.4.2",
269-
"@emotion/weak-memoize": "^0.4.0",
270-
"hoist-non-react-statics": "^3.3.1"
215+
"@emotion/weak-memoize": "^0.4.0"
271216
},
272217
"peerDependencies": {
273218
"react": ">=16.8.0"
@@ -283,7 +228,6 @@
283228
"@emotion/css-prettifier": "1.2.0",
284229
"@emotion/server": "11.11.0",
285230
"@emotion/styled": "11.14.0",
286-
"@types/hoist-non-react-statics": "^3.3.5",
287231
"html-tag-names": "^1.1.2",
288232
"react": "16.14.0",
289233
"svg-tag-names": "^1.1.1",
@@ -298,8 +242,7 @@
298242
"entrypoints": [
299243
"./index.ts",
300244
"./jsx-runtime.ts",
301-
"./jsx-dev-runtime.ts",
302-
"./_isolated-hnrs.ts"
245+
"./jsx-dev-runtime.ts"
303246
],
304247
"umdName": "emotionReact",
305248
"exports": {

packages/react/src/_isolated-hnrs.ts

-15
This file was deleted.

packages/react/src/theming.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as React from 'react'
22
import weakMemoize from '@emotion/weak-memoize'
33
import isDevelopment from '#is-development'
4-
import hoistNonReactStatics from './_isolated-hnrs'
54
import { DistributiveOmit } from './types'
65

76
// tslint:disable-next-line: no-empty-interface
@@ -98,5 +97,5 @@ export function withTheme<
9897

9998
WithTheme.displayName = `WithTheme(${componentName})`
10099

101-
return hoistNonReactStatics(WithTheme, Component)
100+
return WithTheme
102101
}

packages/styled/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
"devDependencies": {
3131
"@definitelytyped/dtslint": "0.0.112",
3232
"@emotion/react": "11.14.0",
33+
"@types/hoist-non-react-statics": "^3.3.5",
34+
"hoist-non-react-statics": "^3.3.1",
3335
"react": "16.14.0",
3436
"typescript": "^5.4.5"
3537
},

yarn.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -2899,8 +2899,6 @@ __metadata:
28992899
"@emotion/use-insertion-effect-with-fallbacks": ^1.2.0
29002900
"@emotion/utils": ^1.4.2
29012901
"@emotion/weak-memoize": ^0.4.0
2902-
"@types/hoist-non-react-statics": ^3.3.5
2903-
hoist-non-react-statics: ^3.3.1
29042902
html-tag-names: ^1.1.2
29052903
react: 16.14.0
29062904
svg-tag-names: ^1.1.1
@@ -2970,6 +2968,8 @@ __metadata:
29702968
"@emotion/serialize": ^1.3.3
29712969
"@emotion/use-insertion-effect-with-fallbacks": ^1.2.0
29722970
"@emotion/utils": ^1.4.2
2971+
"@types/hoist-non-react-statics": ^3.3.5
2972+
hoist-non-react-statics: ^3.3.1
29732973
react: 16.14.0
29742974
typescript: ^5.4.5
29752975
peerDependencies:

0 commit comments

Comments
 (0)