Skip to content

Commit cf79016

Browse files
MichaelDeBoeySaraVieira
authored andcommitted
🔨 Switch SaveAllButton to use useOvermind (#2543)
1 parent dd6b3eb commit cf79016

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import React from 'react';
2-
import { hooksObserver, inject } from 'app/componentConnectors';
1+
import React, { FunctionComponent } from 'react';
32
import SaveIcon from 'react-icons/lib/md/save';
3+
4+
import { useOvermind } from 'app/overmind';
45
import { saveAllModules } from 'app/store/modules/editor/utils';
6+
57
import { Action } from './Action';
68

7-
export const SaveAllButton = inject('store', 'signals')(
8-
hooksObserver(({ store, signals }) => {
9-
const {
10-
editor: { isAllModulesSynced, changedModuleShortids },
11-
} = store;
9+
const noop = () => undefined;
10+
export const SaveAllButton: FunctionComponent = () => {
11+
const { actions, state } = useOvermind();
12+
const {
13+
editor: { isAllModulesSynced, changedModuleShortids },
14+
} = state;
1215

13-
return (
14-
<Action
15-
onClick={
16-
isAllModulesSynced ? null : () => saveAllModules(store, signals)
17-
}
18-
placeholder={isAllModulesSynced ? 'All modules are saved' : false}
19-
blink={changedModuleShortids.length > 2}
20-
title="Save"
21-
Icon={SaveIcon}
22-
/>
23-
);
24-
})
25-
);
16+
return (
17+
<Action
18+
onClick={isAllModulesSynced ? noop : () => saveAllModules(state, actions)}
19+
placeholder={isAllModulesSynced ? 'All modules are saved' : false}
20+
blink={changedModuleShortids.length > 2}
21+
title="Save"
22+
Icon={SaveIcon}
23+
/>
24+
);
25+
};

0 commit comments

Comments
 (0)