Skip to content

Commit 76b38c0

Browse files
committed
disable calling config callback if in readOnly
Signed-off-by: Shan He <[email protected]>
1 parent 0c5941b commit 76b38c0

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

src/App.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,7 @@ class App extends Component {
810810
</div>
811811
);
812812
}
813+
const readOnly = tableauSettingsState.readOnly === 'true'
813814

814815
return (
815816
<KeplerGlComponent
@@ -820,7 +821,7 @@ class App extends Component {
820821
selectedSheet={this.state.selectedSheet}
821822
tableauSettings={tableauSettingsState}
822823
theme={tableauSettingsState.theme}
823-
readOnly={tableauSettingsState.readOnly === 'true'}
824+
readOnly={readOnly}
824825
keplerConfig={tableauSettingsState.keplerConfig}
825826
mapboxAPIKey={
826827
tableauSettingsState.mapboxAPIKey
@@ -829,7 +830,7 @@ class App extends Component {
829830
}
830831
isLoading={isLoading}
831832
// persist state to tableau
832-
configCallBack={this.configCallBack}
833+
configCallBack={readOnly ? null : this.configCallBack}
833834
// interactivity
834835
clickCallBack={this.clickCallBack}
835836
hoverCallBack={this.hoverCallBack}

src/components/KeplerGL/app.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ class App extends Component {
101101
}
102102

103103
handleConfigChange() {
104+
if (typeof this.props.configCallBack !== 'function') {
105+
return;
106+
}
107+
104108
const currentState = this.getMapConfig();
105109
if (!currentState) {
106110
return;

src/reducers.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {combineReducers} from 'redux';
2222
import {handleActions} from 'redux-actions';
2323
import {routerReducer} from 'react-router-redux';
2424
import keplerGlReducer, {visStateUpdaters} from 'kepler.gl/reducers';
25-
import {FILTER_TYPES} from 'kepler.gl/constants';
2625
import {MAP_ID, DATA_ID} from './constants';
2726
import {MARKER_SELECT} from './actions';
2827
import {log} from './utils';

src/store.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@
2020

2121
import {createStore, applyMiddleware, compose} from 'redux';
2222

23-
import window from 'global/window';
2423
import {taskMiddleware} from 'react-palm/tasks';
2524
import {routerMiddleware} from 'react-router-redux';
2625
import {hashHistory} from 'react-router';
2726
import reducers from './reducers';
28-
import KeplerGlSchema from 'kepler.gl/schemas';
2927

3028
export const middlewares = [
3129
taskMiddleware,

0 commit comments

Comments
 (0)