11import { FSModule } from 'browserfs/dist/node/core/FS' ;
2- import { Chapter , Variant } from 'js-slang/dist/types' ;
2+ import { Chapter } from 'js-slang/dist/types' ;
33import { compressToEncodedURIComponent } from 'lz-string' ;
44import qs from 'query-string' ;
55import { SagaIterator } from 'redux-saga' ;
@@ -8,16 +8,19 @@ import CseMachine from 'src/features/cseMachine/CseMachine';
88import { CseMachine as JavaCseMachine } from 'src/features/cseMachine/java/CseMachine' ;
99
1010import PlaygroundActions from '../../features/playground/PlaygroundActions' ;
11- import { isSchemeLanguage , isSourceLanguage , OverallState } from '../application/ApplicationTypes' ;
12- import { ExternalLibraryName } from '../application/types/ExternalTypes' ;
11+ import {
12+ isSchemeLanguage ,
13+ isSourceLanguage ,
14+ type OverallState
15+ } from '../application/ApplicationTypes' ;
1316import { retrieveFilesInWorkspaceAsRecord } from '../fileSystem/utils' ;
1417import { visitSideContent } from '../sideContent/SideContentActions' ;
1518import { SideContentType } from '../sideContent/SideContentTypes' ;
1619import Constants from '../utils/Constants' ;
1720import { showSuccessMessage , showWarningMessage } from '../utils/notifications/NotificationsHelper' ;
1821import WorkspaceActions from '../workspace/WorkspaceActions' ;
19- import { EditorTabState , PlaygroundWorkspaceState } from '../workspace/WorkspaceTypes' ;
20- import { safeTakeEvery as takeEvery } from './SafeEffects' ;
22+ import type { PlaygroundWorkspaceState } from '../workspace/WorkspaceTypes' ;
23+ import { safeTakeEvery as takeEvery , selectWorkspace } from './SafeEffects' ;
2124
2225export default function * PlaygroundSaga ( ) : SagaIterator {
2326 yield takeEvery ( PlaygroundActions . generateLzString . type , updateQueryString ) ;
@@ -127,9 +130,6 @@ export default function* PlaygroundSaga(): SagaIterator {
127130}
128131
129132function * updateQueryString ( ) {
130- const isFolderModeEnabled : boolean = yield select (
131- ( state : OverallState ) => state . workspaces . playground . isFolderModeEnabled
132- ) ;
133133 const fileSystem : FSModule = yield select (
134134 ( state : OverallState ) => state . fileSystem . inBrowserFileSystem
135135 ) ;
@@ -138,27 +138,20 @@ function* updateQueryString() {
138138 'playground' ,
139139 fileSystem
140140 ) ;
141- const editorTabs : EditorTabState [ ] = yield select (
142- ( state : OverallState ) => state . workspaces . playground . editorTabs
143- ) ;
141+
142+ const {
143+ activeEditorTabIndex,
144+ context : { chapter, variant } ,
145+ editorTabs,
146+ execTime,
147+ externalLibrary : external ,
148+ isFolderModeEnabled
149+ } = yield * selectWorkspace ( 'playground' ) ;
150+
144151 const editorTabFilePaths = editorTabs
145- . map ( ( editorTab : EditorTabState ) => editorTab . filePath )
152+ . map ( editorTab => editorTab . filePath )
146153 . filter ( ( filePath ) : filePath is string => filePath !== undefined ) ;
147- const activeEditorTabIndex : number | null = yield select (
148- ( state : OverallState ) => state . workspaces . playground . activeEditorTabIndex
149- ) ;
150- const chapter : Chapter = yield select (
151- ( state : OverallState ) => state . workspaces . playground . context . chapter
152- ) ;
153- const variant : Variant = yield select (
154- ( state : OverallState ) => state . workspaces . playground . context . variant
155- ) ;
156- const external : ExternalLibraryName = yield select (
157- ( state : OverallState ) => state . workspaces . playground . externalLibrary
158- ) ;
159- const execTime : number = yield select (
160- ( state : OverallState ) => state . workspaces . playground . execTime
161- ) ;
154+
162155 const newQueryString = qs . stringify ( {
163156 isFolder : isFolderModeEnabled ,
164157 files : compressToEncodedURIComponent ( qs . stringify ( files ) ) ,
0 commit comments