File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/app/store/entities/sandboxes Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -123,10 +123,19 @@ const forkSandbox = (id: string) => async (
123123 data . currentModule = currentSandbox . currentModule ;
124124 }
125125 data . forked = true ;
126+
127+ // Save the unsaved modules
128+ const oldModules = modulesSelector ( getState ( ) ) ;
126129 await dispatch ( normalizeResult ( entity , data ) ) ;
127130
128131 dispatch ( push ( sandboxUrl ( data ) ) ) ;
129132
133+ // Set the code for the new modules from the old modules
134+ currentSandbox . modules
135+ . map ( mid => oldModules [ mid ] )
136+ . filter ( m => m . isNotSynced )
137+ . forEach ( m => dispatch ( moduleActions . setCode ( m . id , m . code ) ) ) ;
138+
130139 dispatch ( notificationActions . addNotification ( 'Forked sandbox!' , 'success' ) ) ;
131140
132141 return data ;
You can’t perform that action at this time.
0 commit comments