Skip to content

Commit c97c2e9

Browse files
fix: reset databus on upload store
1 parent 205176c commit c97c2e9

8 files changed

Lines changed: 87 additions & 54 deletions

File tree

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codecrumbs",
3-
"version": "1.0.14-alpha",
3+
"version": "1.0.15-alpha",
44
"author": "Bohdan Liashenko",
55
"license": "BSD-3-Clause",
66
"repository": {

‎src/public/dist/local/bundle/main.bundle.js‎

Lines changed: 66 additions & 52 deletions
Large diffs are not rendered by default.

‎src/public/js/core/dataBus/actions.js‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { requestFetchFile } from 'core/dataBus/connection';
22
import { ACTIONS as VIEW_SWITCHES_ACTIONS } from 'core/controlsBus/constants';
3+
import { ACTIONS as NAMESPACE_INTEGRATION_ACTIONS } from 'core/namespaceIntegration/constants';
34
import { getNamespacesList } from 'core/dataBus/selectors';
45
import { getCheckedState, getValuesState, getDisabledState } from 'core/controlsBus/selectors';
56

@@ -286,6 +287,15 @@ export const setPredefinedState = predefinedState => dispatch => {
286287
payload: predefinedState.controlsBus
287288
});
288289

290+
//TODO: add flag on UI to not reset previous state
291+
dispatch({
292+
type: NAMESPACE_INTEGRATION_ACTIONS.RESET_ALL
293+
});
294+
295+
dispatch({
296+
type: ACTIONS.RESET_ALL
297+
});
298+
289299
Object.keys(predefinedState.dataBus).forEach((namespace, i) => {
290300
// TODO: test performance here
291301
setTimeout(() => {

‎src/public/js/core/dataBus/constants.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export const ACTIONS = {
22
SET_INITIAL_SOURCE_DATA: 'DATA_BUS.SET_INITIAL_SOURCE_DATA',
3+
RESET_ALL: 'DATA_BUS.RESET_ALL',
34
SET_CHANGED_SOURCE_DATA: 'DATA_BUS.SET_CHANGED_SOURCE_DATA',
45
UPDATE_FILES_TREE_LAYOUT_NODES: 'DATA_BUS.UPDATE_FILES_TREE_LAYOUT_NODES',
56
SELECT_NODE: 'DATA_BUS.SELECT_NODE',

‎src/public/js/core/dataBus/reducer.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ export default (state = DefaultState, action) => {
176176
}
177177
});
178178

179+
case ACTIONS.RESET_ALL:
180+
return DefaultState;
181+
179182
default:
180183
return state;
181184
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const ACTIONS = {
2-
SET_ACTIVE_NAMESPACE: 'NAMESPACE_INTEGRATION.SET_ACTIVE_NAMESPACE'
2+
SET_ACTIVE_NAMESPACE: 'NAMESPACE_INTEGRATION.SET_ACTIVE_NAMESPACE',
3+
RESET_ALL: 'NAMESPACE_INTEGRATION.RESET_ALL'
34
};

‎src/public/js/core/namespaceIntegration/reducer.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ export default (state = DefaultState, action) => {
1212
activeNamespace: action.payload
1313
};
1414

15+
case ACTIONS.RESET_ALL:
16+
return DefaultState;
17+
1518
default:
1619
return state;
1720
}

‎src/public/webpack.dev.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module.exports = merge(common, {
1313
}),
1414
new webpack.DefinePlugin({
1515
'process.env.LOCAL': JSON.stringify(true),
16+
'process.env.STANDALONE': JSON.stringify(false),
1617
'process.env.VERSION': JSON.stringify(require('../../package.json').version)
1718
})
1819
]

0 commit comments

Comments
 (0)