🚧 pass project and user to autosave

This commit is contained in:
ghalestrilo 2020-08-17 14:57:48 -03:00
parent 6941e06eb3
commit e996d49db3

View file

@ -140,13 +140,15 @@ const handleGlobalKeydown = (props, cmController) => (e) => {
const autosave = (autosaveInterval, setAutosaveInterval) => (props, prevProps) => {
const {
autosaveProject, preferences, ide, selectedFile: file, project
autosaveProject, preferences, ide, selectedFile: file, project, user
} = props;
const { selectedFile: oldFile } = prevProps;
const doAutosave = () => autosaveProject(true);
console.log(user);
console.log(isUserOwner(props), project);
if (isUserOwner(props) && project.id) {
@ -209,7 +211,7 @@ const MobileIDEView = (props) => {
// TODO: This behavior could move to <Editor />
const [autosaveInterval, setAutosaveInterval] = useState(null);
useEffectWithComparison(autosave(autosaveInterval, setAutosaveInterval), {
autosaveProject, preferences, ide, selectedFile
autosaveProject, preferences, ide, selectedFile, project, user
});
useEventListener('keydown', handleGlobalKeydown(props, cmController), false, [props]);