@@ -66,6 +66,44 @@ const getNatOptions = (username = undefined) =>
66
66
]
67
67
) ;
68
68
69
+
70
+ const asd = ( props , prevProps ) => {
71
+ if ( isUserOwner ( this . props ) && this . props . project . id ) {
72
+ if (
73
+ props . preferences . autosave &&
74
+ props . ide . unsavedChanges &&
75
+ ! props . ide . justOpenedProject
76
+ ) {
77
+ if (
78
+ props . selectedFile . name === prevProps . selectedFile . name &&
79
+ props . selectedFile . content !== prevProps . selectedFile . content
80
+ ) {
81
+ if ( this . autosaveInterval ) {
82
+ clearTimeout ( this . autosaveInterval ) ;
83
+ }
84
+ console . log ( 'will save project in 20 seconds' ) ;
85
+ this . autosaveInterval = setTimeout ( props . autosaveProject , 20000 ) ;
86
+ }
87
+ } else if ( this . autosaveInterval && ! props . preferences . autosave ) {
88
+ clearTimeout ( this . autosaveInterval ) ;
89
+ this . autosaveInterval = null ;
90
+ }
91
+ } else if ( this . autosaveInterval ) {
92
+ clearTimeout ( this . autosaveInterval ) ;
93
+ this . autosaveInterval = null ;
94
+ }
95
+ } ;
96
+
97
+ const useEffectWithComparison = ( fn , props ) => {
98
+ const [ prevProps , update ] = useState ( { } ) ;
99
+
100
+ return useEffect ( ( ) => {
101
+ fn ( props , prevProps ) ;
102
+ update ( props ) ;
103
+ } , Object . values ( props ) ) ;
104
+ } ;
105
+
106
+
69
107
const MobileIDEView = ( props ) => {
70
108
const {
71
109
ide, project, selectedFile, user, params, unsavedChanges, collapseConsole,
@@ -103,6 +141,9 @@ const MobileIDEView = (props) => {
103
141
} , [ params , project , username ] ) ;
104
142
105
143
144
+ // useEffectWithComparison(() => alert('haha'), { consoleIsExpanded });
145
+
146
+
106
147
return (
107
148
< Screen fullscreen >
108
149
< Header
0 commit comments