Skip to content

Commit 230e011

Browse files
authored
add react compiler (#28554)
* add react compiler * fix crashing out
1 parent 4b8f46a commit 230e011

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

shared/babel.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,17 @@ module.exports = function (api /*: any */) {
4646
isTest ? ['@babel/preset-env', {targets: {node: 'current'}}] : '@babel/preset-env',
4747
'@babel/preset-typescript',
4848
],
49+
plugins: [
50+
'babel-plugin-react-compiler', // must run first!
51+
],
4952
}
5053
} else if (isReactNative) {
5154
// console.error('KB babel.config.js for ReactNative')
5255
return {
53-
plugins: [['module-resolver', {alias: {'@': './'}}]],
56+
plugins: [
57+
'babel-plugin-react-compiler', // must run first!
58+
['module-resolver', {alias: {'@': './'}}],
59+
],
5460
presets: [['babel-preset-expo', {unstable_transformImportMeta: true, jsxRuntime: 'automatic'}]],
5561
sourceMaps: true,
5662
}

shared/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,17 +153,18 @@
153153
"@types/lodash": "4.17.20",
154154
"@types/lodash-es": "4.17.12",
155155
"@types/react": "19.1.16",
156-
"@types/react-is": "19.0.0",
157156
"@types/react-dom": "19.1.9",
157+
"@types/react-is": "19.0.0",
158158
"@types/react-list": "0.8.12",
159159
"@types/react-measure": "2.0.12",
160160
"@types/shallowequal": "1.1.5",
161161
"@types/webpack-env": "1.18.8",
162162
"@welldone-software/why-did-you-render": "10.0.1",
163163
"babel-loader": "10.0.0",
164-
"babel-preset-expo": "54.0.5",
165164
"babel-plugin-module-resolver": "5.0.2",
165+
"babel-plugin-react-compiler": "1.0.0",
166166
"babel-plugin-react-native-web": "0.21.2",
167+
"babel-preset-expo": "54.0.5",
167168
"circular-dependency-plugin": "5.2.2",
168169
"cross-env": "7.0.3",
169170
"css-loader": "7.1.2",
@@ -172,8 +173,8 @@
172173
"eslint-plugin-deprecation": "3.0.0",
173174
"eslint-plugin-promise": "7.2.1",
174175
"eslint-plugin-react": "7.37.5",
175-
"eslint-plugin-react-hooks": "7.0.0",
176176
"eslint-plugin-react-compiler": "19.1.0-rc.2",
177+
"eslint-plugin-react-hooks": "7.0.0",
177178
"fs-extra": "11.3.2",
178179
"html-webpack-plugin": "5.6.4",
179180
"json5": "2.2.3",

shared/teams/team/rows/index.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,20 @@ export const useChannelsSections = (
204204
const createRow = canCreate
205205
? [{data: [{type: 'channel-add'}], renderItem: () => <ChannelHeaderRow teamID={teamID} />} as const]
206206
: []
207+
208+
const channelsValues = [...channels.values()]
207209
return [
208210
...createRow,
209211
{
210-
data: [...channels.values().map(c => ({c, type: 'channel-channels'}))].sort((a, b) =>
211-
a.c.channelname === 'general'
212-
? -1
213-
: b.c.channelname === 'general'
214-
? 1
215-
: a.c.channelname.localeCompare(b.c.channelname)
216-
),
212+
data: channelsValues
213+
.map(c => ({c, type: 'channel-channels'}))
214+
.sort((a, b) =>
215+
a.c.channelname === 'general'
216+
? -1
217+
: b.c.channelname === 'general'
218+
? 1
219+
: a.c.channelname.localeCompare(b.c.channelname)
220+
),
217221
renderItem: ({item}: {item: Item}) =>
218222
item.type === 'channel-channels' ? (
219223
<ChannelRow teamID={teamID} conversationIDKey={item.c.conversationIDKey} />

shared/yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3904,7 +3904,7 @@ babel-plugin-polyfill-regenerator@^0.6.5:
39043904
dependencies:
39053905
"@babel/helper-define-polyfill-provider" "^0.6.5"
39063906

3907-
babel-plugin-react-compiler@^1.0.0:
3907+
babel-plugin-react-compiler@1.0.0, babel-plugin-react-compiler@^1.0.0:
39083908
version "1.0.0"
39093909
resolved "https://registry.yarnpkg.com/babel-plugin-react-compiler/-/babel-plugin-react-compiler-1.0.0.tgz#bdf7360a23a4d5ebfca090255da3893efd07425f"
39103910
integrity sha512-Ixm8tFfoKKIPYdCCKYTsqv+Fd4IJ0DQqMyEimo+pxUOMUR9cVPlwTrFt9Avu+3cb6Zp3mAzl+t1MrG2fxxKsxw==

0 commit comments

Comments
 (0)