🚧 pass project and user to autosave
This commit is contained in:
parent
6941e06eb3
commit
e996d49db3
1 changed files with 4 additions and 2 deletions
|
@ -140,13 +140,15 @@ const handleGlobalKeydown = (props, cmController) => (e) => {
|
||||||
|
|
||||||
const autosave = (autosaveInterval, setAutosaveInterval) => (props, prevProps) => {
|
const autosave = (autosaveInterval, setAutosaveInterval) => (props, prevProps) => {
|
||||||
const {
|
const {
|
||||||
autosaveProject, preferences, ide, selectedFile: file, project
|
autosaveProject, preferences, ide, selectedFile: file, project, user
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const { selectedFile: oldFile } = prevProps;
|
const { selectedFile: oldFile } = prevProps;
|
||||||
|
|
||||||
const doAutosave = () => autosaveProject(true);
|
const doAutosave = () => autosaveProject(true);
|
||||||
|
|
||||||
|
console.log(user);
|
||||||
|
|
||||||
console.log(isUserOwner(props), project);
|
console.log(isUserOwner(props), project);
|
||||||
|
|
||||||
if (isUserOwner(props) && project.id) {
|
if (isUserOwner(props) && project.id) {
|
||||||
|
@ -209,7 +211,7 @@ const MobileIDEView = (props) => {
|
||||||
// TODO: This behavior could move to <Editor />
|
// TODO: This behavior could move to <Editor />
|
||||||
const [autosaveInterval, setAutosaveInterval] = useState(null);
|
const [autosaveInterval, setAutosaveInterval] = useState(null);
|
||||||
useEffectWithComparison(autosave(autosaveInterval, setAutosaveInterval), {
|
useEffectWithComparison(autosave(autosaveInterval, setAutosaveInterval), {
|
||||||
autosaveProject, preferences, ide, selectedFile
|
autosaveProject, preferences, ide, selectedFile, project, user
|
||||||
});
|
});
|
||||||
|
|
||||||
useEventListener('keydown', handleGlobalKeydown(props, cmController), false, [props]);
|
useEventListener('keydown', handleGlobalKeydown(props, cmController), false, [props]);
|
||||||
|
|
Loading…
Reference in a new issue