Skip to content

Commit a380afc

Browse files
igorDykhtaIhor Dykhta
andauthored
chore: upgrade to React 19 (#3514)
* chore: upgrade to React 19 Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * remove unused radius by zoom Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * fix linechart Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * fix transform-origin Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * upgrade react-router Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * bump styled components Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * fix react warnings Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * try to fix CI lint Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * try to fix CI lint Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * try to fix tests Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * try to fix tests Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * fix netlify builds Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * fix testS Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * fix testS Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * fix tests Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * fix tests Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * try to fix browser tests Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * try to fix netlify build Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * follow up Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * revert ts change Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * bump website Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * fix swipe mode regression Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * fixes for website Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * pin exported umd version to older umd release Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * fix website Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> --------- Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> Co-authored-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local>
1 parent 3c0fe3f commit a380afc

107 files changed

Lines changed: 2613 additions & 1991 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313
},
1414
parser: '@typescript-eslint/parser',
1515
extends: ['eslint:recommended', 'plugin:prettier/recommended', 'plugin:react-hooks/recommended'],
16-
plugins: ['babel', 'prettier', 'react', 'enzyme-deprecation'],
16+
plugins: ['babel', 'prettier', 'react'],
1717
rules: {
1818
'valid-jsdoc': 0,
1919
'no-var': 0,
@@ -37,8 +37,6 @@ module.exports = {
3737
camelcase: 0,
3838
'consistent-return': 0,
3939
'comma-dangle': 1,
40-
'enzyme-deprecation/no-shallow': 2,
41-
'enzyme-deprecation/no-mount': 2,
4240
'no-constant-condition': ['error', {checkLoops: false}],
4341
'no-unused-vars': ['warn', {argsIgnorePattern: '^_', varsIgnorePattern: '^_'}],
4442
'@typescript-eslint/no-unused-vars': [

babel.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const getPlugins = isTest => {
3232
root: ['./src'],
3333
alias: {
3434
test: './test',
35+
enzyme: './test/helpers/enzyme-adapter.js',
36+
'@cfaester/enzyme-adapter-react-18': './test/helpers/enzyme-mock.js',
3537
// We explicitly transpile this ESM library in scripts/fix-dependencies.js and consume the transpiled version here
3638
// This may not be needed once switch to Jest is complete as it is handled by transformIgnorePatterns
3739
'@mapbox/tiny-sdf': `${nodeModules}/@mapbox/tiny-sdf/index.cjs`,

bindings/kepler.gl-jupyter/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"react-redux": "^8.0.5",
9494
"redux": "^4.2.1",
9595
"redux-actions": "^2.2.1",
96-
"styled-components": "6.1.8"
96+
"styled-components": "6.4.3"
9797
},
9898
"resolutions": {
9999
"@deck.gl/core": "^8.9.27",

bindings/python/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
"react-dom": "^18.2.0",
3434
"react-redux": "^8.0.5",
3535
"redux": "^4.2.1",
36-
"styled-components": "^6.1.8"
36+
"styled-components": "^6.4.3"
3737
}
3838
}

examples/custom-map-style/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"react-redux": "^8.0.5",
1515
"react-virtualized": "^9.21.0",
1616
"redux-actions": "^2.2.1",
17-
"styled-components": "6.1.8"
17+
"styled-components": "6.4.3"
1818
},
1919
"devDependencies": {
2020
"@dotenv-run/esbuild": "^1.5.0",

examples/custom-reducer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"react-redux": "^8.0.5",
1616
"react-virtualized": "^9.21.0",
1717
"redux-actions": "^2.2.1",
18-
"styled-components": "6.1.8"
18+
"styled-components": "6.4.3"
1919
},
2020
"devDependencies": {
2121
"@dotenv-run/esbuild": "^1.5.0",

examples/custom-theme/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"react-redux": "^8.0.5",
1515
"react-virtualized": "^9.21.0",
1616
"redux-actions": "^2.2.1",
17-
"styled-components": "6.1.8"
17+
"styled-components": "6.4.3"
1818
},
1919
"devDependencies": {
2020
"@dotenv-run/esbuild": "^1.5.0",

examples/demo-app/esbuild.config.mjs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ const getThirdPartyLibraryAliases = useKeplerNodeModules => {
4141
...localSources,
4242
react: `${nodeModulesDir}/react`,
4343
'react-dom': `${nodeModulesDir}/react-dom`,
44-
'react-redux': `${nodeModulesDir}/react-redux/lib`,
44+
'react-dom/client': `${nodeModulesDir}/react-dom/client`,
45+
'react-redux': `${nodeModulesDir}/react-redux`,
4546
'styled-components': `${nodeModulesDir}/styled-components`,
4647
'react-intl': `${nodeModulesDir}/react-intl`,
4748
'react-palm': `${nodeModulesDir}/react-palm`,
@@ -50,6 +51,13 @@ const getThirdPartyLibraryAliases = useKeplerNodeModules => {
5051
};
5152
};
5253

54+
const getProductionReactAliases = nodeModulesDir => ({
55+
react: `${nodeModulesDir}/react/cjs/react.production.js`,
56+
'react/jsx-runtime': `${nodeModulesDir}/react/cjs/react-jsx-runtime.production.js`,
57+
'react-dom': `${nodeModulesDir}/react-dom/cjs/react-dom.production.js`,
58+
'react-dom/client': `${nodeModulesDir}/react-dom/cjs/react-dom-client.production.js`
59+
});
60+
5361
// Env variables required for demo app
5462
const requiredEnvVariables = [
5563
'MapboxAccessToken',
@@ -80,6 +88,7 @@ const config = {
8088
platform: 'browser',
8189
format: 'iife',
8290
logLevel: 'info',
91+
inject: ['src/react19-shim.js'],
8392
loader: {
8493
'.js': 'jsx',
8594
'.css': 'css',
@@ -291,15 +300,21 @@ function openURL(url) {
291300
}
292301

293302
if (args.includes('--start')) {
303+
const isLocal = process.env.NODE_ENV === 'local';
304+
const baseAliases = isLocal
305+
? localAliases
306+
: getThirdPartyLibraryAliases(false);
307+
const nodeModulesDir = isLocal ? NODE_MODULES_DIR : BASE_NODE_MODULES_DIR;
308+
294309
await esbuild
295310
.context({
296311
...config,
297312
minify: false,
298313
sourcemap: true,
299-
// add alias to resolve libraries so there is only one copy of them
300-
...(process.env.NODE_ENV === 'local'
301-
? {alias: localAliases}
302-
: {alias: getThirdPartyLibraryAliases(false)}),
314+
alias: {
315+
...baseAliases,
316+
...(!isLocal ? getProductionReactAliases(nodeModulesDir) : {})
317+
},
303318
banner: {
304319
js: `new EventSource('/esbuild').addEventListener('change', () => location.reload());`
305320
}

examples/demo-app/package.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,25 @@
4343
"keymirror": "^0.1.1",
4444
"markdown-to-jsx": "^7.7.6",
4545
"prop-types": "^15.6.0",
46-
"react": "^18.2.0",
47-
"react-dom": "^18.2.0",
48-
"react-intl": "^6.3.0",
49-
"react-redux": "^8.0.5",
46+
"react": "^19.0.0",
47+
"react-dom": "^19.0.0",
48+
"react-intl": "^7.0.0",
49+
"react-redux": "^9.1.0",
5050
"react-resizable-panels": "^2.1.7",
51-
"react-router": "3.2.5",
52-
"react-router-redux": "^4.0.8",
51+
"react-router-dom": "^6.28.0",
5352
"react-virtualized": "^9.21.0",
54-
"redux": "^4.2.1",
53+
"redux": "^5.0.0",
5554
"redux-actions": "^2.2.1",
5655
"redux-logger": "^3.0.6",
5756
"redux-thunk": "^1.0.0",
58-
"styled-components": "6.1.8",
57+
"styled-components": "6.4.3",
5958
"usehooks-ts": "^3.1.0"
6059
},
6160
"resolutions": {
6261
"@luma.gl/core": "8.5.21",
6362
"@luma.gl/webgl": "8.5.21",
6463
"@deck.gl/core": "8.9.27",
65-
"@deck.gl/extensions": "8.9.27",
66-
"react-vis": "1.11.7"
64+
"@deck.gl/extensions": "8.9.27"
6765
},
6866
"engines": {
6967
"node": ">=20"

examples/demo-app/src/actions.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: MIT
22
// Copyright contributors to the kepler.gl project
33

4-
import {push} from 'react-router-redux';
54
import {fetch} from 'global';
65

76
import {loadFiles, toggleModal} from '@kepler.gl/actions';
@@ -84,23 +83,21 @@ export function setLoadingMapStatus(isMapLoading) {
8483
* @param {*} param0
8584
*/
8685
export function onExportFileSuccess({provider, options}) {
87-
return dispatch => {
88-
// if isPublic is true, use share Url
86+
return () => {
8987
if (options.isPublic && provider.getShareUrl) {
90-
dispatch(push(provider.getShareUrl(false)));
88+
window.history.pushState(null, '', provider.getShareUrl(false));
9189
} else if (!options.isPublic && provider.getMapUrl) {
92-
// if save private map to storage, use map url
93-
dispatch(push(provider.getMapUrl(false)));
90+
window.history.pushState(null, '', provider.getMapUrl(false));
9491
}
9592
};
9693
}
9794

9895
export function onLoadCloudMapSuccess({provider, loadParams}) {
99-
return dispatch => {
96+
return () => {
10097
const mapUrl = provider?.getMapUrl(loadParams);
10198
if (mapUrl) {
10299
const url = `/demo/map/${provider.name}?path=${mapUrl}`;
103-
dispatch(push(url));
100+
window.history.pushState(null, '', url);
104101
}
105102
};
106103
}
@@ -176,10 +173,10 @@ function loadRemoteRawData(url) {
176173
* @returns {Function}
177174
*/
178175
export function loadSample(options, pushRoute = true) {
179-
return (dispatch, getState) => {
180-
const {routing} = getState();
176+
return (dispatch) => {
181177
if (options.id && pushRoute) {
182-
dispatch(push(`/demo/${options.id}${routing.locationBeforeTransitions?.search ?? ''}`));
178+
const search = window.location.search || '';
179+
window.history.pushState(null, '', `/demo/${options.id}${search}`);
183180
}
184181
// if the sample has a kepler.gl config file url we load it
185182
if (options.keplergl) {

0 commit comments

Comments
 (0)