Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,14 @@ Here are the basic steps to import kepler.gl into your app. You also take a look

### 1. Mount reducer

Kepler.gl uses Redux to manage its internal state, along with [react-palm][react-palm] middleware to handle side effects.
Kepler.gl uses Redux to manage its internal state, along with a built-in task middleware to handle async side effects.

You need to add `taskMiddleware` of `react-palm` to your store too. We are actively working on a solution where
`react-palm` will not be required, however it is still a very lightweight side effects management tool that is easier to test than react-thunk.
You need to add `taskMiddleware` to your store. The easiest way is via `enhanceReduxMiddleware` from `@kepler.gl/reducers`:

```js
import {createStore, combineReducers, applyMiddleware, compose} from 'redux';
import keplerGlReducer from '@kepler.gl/reducers';
import {enhanceReduxMiddleware} from '@kepler.gl/middleware';
import {enhanceReduxMiddleware} from '@kepler.gl/reducers';

const initialState = {};
const reducers = combineReducers({
Expand Down Expand Up @@ -525,7 +524,6 @@ Read more about [addDataToMap](./docs/api-reference/actions/actions.md#adddatato
[mapbox-token]: https://www.mapbox.com/help/define-access-token/
[developers]: contributing/DEVELOPERS.md
[examples]: https://github.com/keplergl/kepler.gl/tree/master/examples
[react-palm]: https://github.com/btford/react-palm
[roadmap]: https://github.com/keplergl/kepler.gl/wiki/Kepler.gl-2019-Roadmap
[stack]: https://stackoverflow.com/questions/tagged/kepler.gl
[web]: http://www.kepler.gl/
Expand Down
1 change: 1 addition & 0 deletions UPGRADE-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ See the full upgrade guide: **[Upgrade Guide — kepler.gl 3.3](docs/upgrade-gui
- **HeatmapLayer** — rewritten from Mapbox GL to deck.gl base
- **`layerOrder`** — type changed from flat `string[]` to `(string | LayerOrderGroup)[]`
- **`LayerSelectorPanelFactory`** — removed from `@kepler.gl/components`
- **`react-palm` removed** — replace `import {taskMiddleware} from 'react-palm/tasks'` with `import {taskMiddleware} from '@kepler.gl/tasks'`

## Upgrade from v2.4 to v3.0

Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/actions/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Type: [Object][164]
// store.js
import {handleActions} from 'redux-actions';
import {createStore, combineReducers, applyMiddleware} from 'redux';
import {taskMiddleware} from 'react-palm/tasks';
import {taskMiddleware} from '@kepler.gl/tasks';

import keplerGlReducer from '@kepler.gl/reducers';
import {ActionTypes} from '@kepler.gl/actions';
Expand Down
12 changes: 8 additions & 4 deletions docs/api-reference/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,11 @@ export default Root;

#### 1. Mount reducer

Kepler.gl uses [Redux](https://redux.js.org/) to manage its internal state, along with [react-palm](https://github.com/btford/react-palm) middleware to handle side effects. Mount kepler.gl reducer in your store, apply `taskMiddleware`.
Kepler.gl uses [Redux](https://redux.js.org/) to manage its internal state, along with a built-in task middleware to handle async side effects. Mount kepler.gl reducer in your store and apply the middleware using `enhanceReduxMiddleware`:

```js
import keplerGlReducer from '@kepler.gl/reducers';
import keplerGlReducer, {enhanceReduxMiddleware} from '@kepler.gl/reducers';
import {createStore, combineReducers, applyMiddleware} from 'redux';
import {taskMiddleware} from 'react-palm/tasks';

const reducer = combineReducers({
// <-- mount kepler.gl reducer in your app
Expand All @@ -106,9 +105,14 @@ const reducer = combineReducers({
app: appReducer
});

const middlewares = enhanceReduxMiddleware([
// Add other middlewares here
]);

// create store
const store = createStore(reducer, {}, applyMiddleware(taskMiddleware));
const store = createStore(reducer, {}, applyMiddleware(...middlewares));
```

If you mount `keplerGlReducer` in another address instead of `keplerGl`, or it is not
mounted at root of your reducer, you will need to specify the path to it when you mount the component with the `getState` prop.

Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/reducers/reducers.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ to mount it at another address e.g. `foo` you will need to specify it when you m
```javascript
import keplerGlReducer from '@kepler.gl/reducers';
import {createStore, combineReducers, applyMiddleware, compose} from 'redux';
import {taskMiddleware} from 'react-palm/tasks';
import {taskMiddleware} from '@kepler.gl/tasks';

const initialState = {};
const reducers = combineReducers({
Expand Down
57 changes: 57 additions & 0 deletions docs/upgrade-guide-v3.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,70 @@ kepler.gl 3.3 upgrades the rendering stack from **deck.gl 8 / luma.gl 8** to **d
| ----------------------------------- | ------------------------------------------------ |
| `hubble.gl/core`, `hubble.gl/react` | Removed from kepler.gl |
| `@nebula.gl/layers` | Replaced by `@deck.gl-community/editable-layers` |
| `react-palm` | Replaced by built-in task runtime in `@kepler.gl/tasks` |

### Yarn resolutions

All `@deck.gl/*`, `@loaders.gl/*`, and `@luma.gl/*` packages are pinned via resolutions. If your project has its own resolutions for these packages, make sure they are consistent with the versions above.

---

## Breaking Changes — `react-palm` removed

kepler.gl no longer depends on `react-palm`. The task middleware that handles async side effects is now built into `@kepler.gl/tasks`.

### Store setup migration

**Before (v3.2 and earlier):**

```js
import {taskMiddleware} from 'react-palm/tasks';
import {createStore, applyMiddleware} from 'redux';
import keplerGlReducer from '@kepler.gl/reducers';

const store = createStore(reducer, {}, applyMiddleware(taskMiddleware));
```

**After (v3.3+) — recommended:**

```js
import keplerGlReducer, {enhanceReduxMiddleware} from '@kepler.gl/reducers';
import {createStore, applyMiddleware} from 'redux';

const store = createStore(reducer, {}, applyMiddleware(...enhanceReduxMiddleware()));
```

**After (v3.3+) — if you prefer importing `taskMiddleware` directly:**

```js
import {taskMiddleware} from '@kepler.gl/tasks';
import {createStore, applyMiddleware} from 'redux';

const store = createStore(reducer, {}, applyMiddleware(taskMiddleware));
```

### Why this matters

If you continue to import `taskMiddleware` from `react-palm/tasks` after upgrading, kepler.gl's internal async operations (file loading, map style fetching, cloud save/load) will **silently stop working** — the middleware will watch the wrong task queue. There is no runtime error; tasks simply never complete.

### What to do

1. Remove `react-palm` from your `package.json` dependencies.
2. Replace any `import {taskMiddleware} from 'react-palm/tasks'` with `import {taskMiddleware} from '@kepler.gl/tasks'` — or switch to `enhanceReduxMiddleware` from `@kepler.gl/reducers` (recommended).
3. Run `npm install` / `yarn install` to remove the `react-palm` package.

### `enhanceReduxMiddleware` is unchanged

The `enhanceReduxMiddleware` helper from `@kepler.gl/reducers` — the recommended way to set up the store — continues to work identically. If your app already uses `enhanceReduxMiddleware`, **no migration is needed**.

```js
// This pattern requires zero changes
import keplerGlReducer, {enhanceReduxMiddleware} from '@kepler.gl/reducers';
const middlewares = enhanceReduxMiddleware([thunk, myOtherMiddleware]);
```

---

## Breaking Changes — React 19

kepler.gl 3.3 requires **React 19**. React 18 is no longer supported.
Expand Down
3 changes: 1 addition & 2 deletions examples/custom-map-style/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"global": "^4.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-palm": "^3.3.6",
"react-redux": "^8.0.5",
"react-virtualized": "^9.21.0",
"redux-actions": "^2.2.1",
Expand All @@ -22,4 +21,4 @@
"esbuild-plugin-copy": "^2.1.1",
"esbuild-plugin-replace": "^1.4.0"
}
}
}
3 changes: 1 addition & 2 deletions examples/custom-reducer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"global": "^4.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-palm": "^3.3.6",
"react-redux": "^8.0.5",
"react-virtualized": "^9.21.0",
"redux-actions": "^2.2.1",
Expand All @@ -23,4 +22,4 @@
"esbuild-plugin-copy": "^2.1.1",
"esbuild-plugin-replace": "^1.4.0"
}
}
}
3 changes: 1 addition & 2 deletions examples/custom-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"global": "^4.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-palm": "^3.3.6",
"react-redux": "^8.0.5",
"react-virtualized": "^9.21.0",
"redux-actions": "^2.2.1",
Expand All @@ -22,4 +21,4 @@
"esbuild-plugin-copy": "^2.1.1",
"esbuild-plugin-replace": "^1.4.0"
}
}
}
2 changes: 1 addition & 1 deletion examples/demo-app/src/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import {combineReducers} from 'redux';
import {handleActions} from 'redux-actions';
import Task, {withTask} from 'react-palm/tasks';
import Task, {withTask} from '@kepler.gl/tasks';

import {aiAssistantReducer} from '@kepler.gl/ai-assistant';
import {EXPORT_MAP_FORMATS} from '@kepler.gl/constants';
Expand Down
3 changes: 1 addition & 2 deletions examples/node-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"global": "^4.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-palm": "^3.3.6",
"react-redux": "^8.0.5",
"react-virtualized": "^9.21.0",
"redux-actions": "^2.2.1",
Expand All @@ -23,4 +22,4 @@
"esbuild-plugin-copy": "^2.1.1",
"esbuild-plugin-replace": "^1.4.0"
}
}
}
3 changes: 1 addition & 2 deletions examples/open-modal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-modal": "^3.1.10",
"react-palm": "^3.3.6",
"react-redux": "^8.0.5",
"react-virtualized": "^9.21.0",
"redux-actions": "^2.2.1",
Expand All @@ -23,4 +22,4 @@
"esbuild-plugin-copy": "^2.1.1",
"esbuild-plugin-replace": "^1.4.0"
}
}
}
3 changes: 1 addition & 2 deletions examples/replace-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"global": "^4.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-palm": "^3.3.6",
"react-redux": "^8.0.5",
"react-virtualized": "^9.21.0",
"redux-actions": "^2.2.1",
Expand All @@ -33,4 +32,4 @@
"yarn": "4.4.0"
},
"packageManager": "yarn@4.4.0"
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"./src/schemas",
"./src/cloud-providers",
"./src/processors",
"./src/tasks-core",
"./src/tasks",
"./src/actions",
"./src/effects",
Expand Down
1 change: 0 additions & 1 deletion src/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"@types/react-redux": "^7.1.23",
"@types/redux-actions": "^2.6.2",
"lodash": "4.17.23",
"react-palm": "^3.3.8",
"react-redux": "^8.0.5",
"redux": "^5.0.0",
"redux-actions": "^2.2.1"
Expand Down
2 changes: 1 addition & 1 deletion src/actions/src/action-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const ACTION_PREFIX = '@@kepler.gl/';
* // store.js
* import {handleActions} from 'redux-actions';
* import {createStore, combineReducers, applyMiddleware} from 'redux';
* import {taskMiddleware} from 'react-palm/tasks';
* import {taskMiddleware} from '@kepler.gl/tasks';
*
Comment thread
igorDykhta marked this conversation as resolved.
* import keplerGlReducer from '@kepler.gl/reducers';
* import {ActionTypes} from '@kepler.gl/actions';
Expand Down
1 change: 0 additions & 1 deletion src/reducers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"deepmerge": "^4.2.2",
"global": "^4.3.0",
"lodash": "4.17.23",
"react-palm": "^3.3.8",
"redux": "^5.0.0",
"redux-actions": "^2.2.1",
"reselect": "^5.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/reducers/src/map-style-updaters.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project

import Task, {withTask} from 'react-palm/tasks';
import Task, {withTask} from '@kepler.gl/tasks';
import cloneDeep from 'lodash/cloneDeep';
import Console from 'global/console';

Expand Down
2 changes: 1 addition & 1 deletion src/reducers/src/merger-handler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project

import {getGlobalTaskQueue} from 'react-palm/tasks';
import {getGlobalTaskQueue} from '@kepler.gl/tasks';
import {isObject} from '@kepler.gl/utils';
import {toArray} from '@kepler.gl/common-utils';
import {ValueOf} from '@kepler.gl/types';
Expand Down
8 changes: 3 additions & 5 deletions src/reducers/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
// Copyright contributors to the kepler.gl project

// Extra helpers for redux
// We are exposing this secause react-palm has no UMD module and
// users need taskMiddleware to initiate their redux middle ware
import {taskMiddleware} from 'react-palm/tasks';
import {taskMiddleware} from '@kepler.gl/tasks';
import {Middleware} from 'redux';

/**
* This method is used to enhance redux middleware and provide
* functionality to support react-palm
* functionality to support the kepler.gl task system
* @param middlewares current redux middlewares
* @returns {*[]} the original list of middlewares plus the react-palm middleware
* @returns {*[]} the original list of middlewares plus the task middleware
*/
export function enhanceReduxMiddleware(middlewares: Middleware[] = []): Middleware[] {
return [...middlewares, taskMiddleware];
Expand Down
7 changes: 4 additions & 3 deletions src/reducers/src/provider-state-updaters.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project

import Task, {withTask} from 'react-palm/tasks';
import Task, {withTask} from '@kepler.gl/tasks';
import type {TaskDescriptor} from '@kepler.gl/tasks';
import Console from 'global/console';
import {getApplicationConfig, getError, isPlainObject} from '@kepler.gl/utils';
import {generateHashId, toArray} from '@kepler.gl/common-utils';
Expand Down Expand Up @@ -166,7 +167,7 @@ export const exportFileSuccessUpdater = (
createActionTask(onSuccess, {response, provider, options}),
closeModal &&
ACTION_TASK().map(() => postSaveLoadSuccess(`Map saved to ${state.currentProvider}!`))
].filter(d => d);
].filter((d): d is TaskDescriptor => Boolean(d));

return tasks.length ? withTask(newState, tasks) : newState;
};
Expand Down Expand Up @@ -407,7 +408,7 @@ export const loadCloudMapSuccess2Updater = (
ACTION_TASK().map(() => addDataToMap(datasetsPayload)),
createActionTask(onSuccess, {response, loadParams, provider}),
ACTION_TASK().map(() => postSaveLoadSuccess(`Map from ${provider.name} loaded`))
].filter(d => d);
].filter((d): d is TaskDescriptor => Boolean(d));

return tasks.length ? withTask(newState, tasks) : newState;
};
Expand Down
2 changes: 1 addition & 1 deletion src/reducers/src/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ function decorate(target, savedInitialState = {}) {
* @example
* import keplerGlReducer from '@kepler.gl/reducers';
* import {createStore, combineReducers, applyMiddleware, compose} from 'redux';
* import {taskMiddleware} from 'react-palm/tasks';
* import {taskMiddleware} from '@kepler.gl/tasks';
*
* const initialState = {};
Comment thread
igorDykhta marked this conversation as resolved.
* const reducers = combineReducers({
Expand Down
Loading
Loading