@@ -12,13 +12,12 @@ import PreviewFrame from '../components/PreviewFrame';
12
12
import Console from '../components/Console' ;
13
13
import Toast from '../components/Toast' ;
14
14
import { updateFileContent } from '../actions/files' ;
15
- import { setPreviousPath , stopSketch } from '../actions/ide' ;
15
+ import { stopSketch } from '../actions/ide' ;
16
16
import {
17
17
autosaveProject ,
18
18
clearPersistedState ,
19
19
getProject
20
20
} from '../actions/project' ;
21
- import { selectActiveFile } from '../selectors/files' ;
22
21
import { getIsUserOwner } from '../selectors/users' ;
23
22
import RootPage from '../../../components/RootPage' ;
24
23
import Header from '../components/Header' ;
@@ -72,7 +71,6 @@ export const CmControllerContext = React.createContext({});
72
71
73
72
const IDEView = ( props ) => {
74
73
const ide = useSelector ( ( state ) => state . ide ) ;
75
- const selectedFile = useSelector ( selectActiveFile ) ;
76
74
const preferences = useSelector ( ( state ) => state . preferences ) ;
77
75
const project = useSelector ( ( state ) => state . project ) ;
78
76
const isUserOwner = useSelector ( getIsUserOwner ) ;
@@ -87,11 +85,6 @@ const IDEView = (props) => {
87
85
88
86
const autosaveIntervalRef = useRef ( null ) ;
89
87
90
- const location = useLocation ( ) ;
91
-
92
- const prevFileNameRef = useRef ( selectedFile . name ) ;
93
- const locationRef = useRef ( location . pathname ) ;
94
-
95
88
const syncFileContent = ( ) => {
96
89
const file = cmRef . current . getContent ( ) ;
97
90
dispatch ( updateFileContent ( file . id , file . content ) ) ;
@@ -123,16 +116,15 @@ const IDEView = (props) => {
123
116
}
124
117
125
118
if ( shouldAutosave ) {
126
- autosaveIntervalRef . current = setTimeout ( handleAutosave , 10000 ) ;
119
+ autosaveIntervalRef . current = setTimeout ( handleAutosave , 5000 ) ;
127
120
}
128
- prevFileNameRef . current = selectedFile . name ;
129
121
130
122
return ( ) => {
131
123
if ( autosaveIntervalRef . current ) {
132
124
clearTimeout ( autosaveIntervalRef . current ) ;
133
125
}
134
126
} ;
135
- } , [ shouldAutosave , dispatch ] ) ;
127
+ } , [ shouldAutosave , dispatch ] ) ;
136
128
137
129
return (
138
130
< RootPage >
0 commit comments