Skip to content

Commit 14431f0

Browse files
remo5000ning-y
authored andcommitted
Fix display builtin not working in playground (#223)
* Make externalContext compulsory for frontend usage This ensures the continuity of the externalContext (workspaceLocation) even when resetting the context, as we are forced to provide the paramter * Remove default value for action * Format actionCreator
1 parent 76c7b61 commit 14431f0

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/actions/interpreter.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ import { WorkspaceLocation } from './workspaces'
55

66
// TODO fix this immediately after location
77
// is implemented completely
8-
export const handleConsoleLog = (
9-
logString: string,
10-
workspaceLocation: WorkspaceLocation = 'assessment'
11-
) => ({
8+
export const handleConsoleLog = (logString: string, workspaceLocation: WorkspaceLocation) => ({
129
type: actionTypes.HANDLE_CONSOLE_LOG,
1310
payload: { logString, workspaceLocation }
1411
})

src/reducers/workspaces.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ export const reducer: Reducer<IWorkspaceManagerState> = (
187187
...state[location],
188188
context: createContext<WorkspaceLocation>(
189189
action.payload.chapter,
190-
action.payload.externals
190+
action.payload.externals,
191+
location
191192
),
192193
externals: action.payload.externals
193194
}

src/utils/slangHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function visualiseList(list: any) {}
7878
* provides the original function with the required
7979
* externalBuiltIns, such as display and prompt.
8080
*/
81-
export function createContext<T>(chapter = 1, externals: string[] = [], externalContext?: T) {
81+
export function createContext<T>(chapter = 1, externals: string[] = [], externalContext: T) {
8282
const externalBuiltIns = {
8383
display,
8484
prompt: cadetPrompt,

0 commit comments

Comments
 (0)