app stuck on blur when engine errors (#682)
* temp fix for when engine returns error * don't add extrued to show function
This commit is contained in:
@ -50,7 +50,7 @@ export const MemoryPanel = ({
|
|||||||
|
|
||||||
export const processMemory = (programMemory: ProgramMemory) => {
|
export const processMemory = (programMemory: ProgramMemory) => {
|
||||||
const processedMemory: any = {}
|
const processedMemory: any = {}
|
||||||
Object.keys(programMemory.root).forEach((key) => {
|
Object.keys(programMemory?.root || {}).forEach((key) => {
|
||||||
const val = programMemory.root[key]
|
const val = programMemory.root[key]
|
||||||
if (typeof val.value !== 'function') {
|
if (typeof val.value !== 'function') {
|
||||||
if (val.type === 'SketchGroup') {
|
if (val.type === 'SketchGroup') {
|
||||||
|
@ -321,7 +321,7 @@ export function extrudeSketch(
|
|||||||
[0, 'index'],
|
[0, 'index'],
|
||||||
]
|
]
|
||||||
return {
|
return {
|
||||||
modifiedAst: addToShow(_node, name),
|
modifiedAst: node,
|
||||||
pathToNode: [...pathToNode.slice(0, -1), [showCallIndex, 'index']],
|
pathToNode: [...pathToNode.slice(0, -1), [showCallIndex, 'index']],
|
||||||
pathToExtrudeArg,
|
pathToExtrudeArg,
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,10 @@ interface ResultCommand extends CommandInfo {
|
|||||||
data: any
|
data: any
|
||||||
raw: WebSocketResponse
|
raw: WebSocketResponse
|
||||||
}
|
}
|
||||||
|
interface FailedCommand extends CommandInfo {
|
||||||
|
type: 'failed'
|
||||||
|
errors: Models['FailureWebSocketResponse_type']['errors']
|
||||||
|
}
|
||||||
interface PendingCommand extends CommandInfo {
|
interface PendingCommand extends CommandInfo {
|
||||||
type: 'pending'
|
type: 'pending'
|
||||||
promise: Promise<any>
|
promise: Promise<any>
|
||||||
@ -30,7 +34,7 @@ interface PendingCommand extends CommandInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ArtifactMap {
|
export interface ArtifactMap {
|
||||||
[key: string]: ResultCommand | PendingCommand
|
[key: string]: ResultCommand | PendingCommand | FailedCommand
|
||||||
}
|
}
|
||||||
export interface SourceRangeMap {
|
export interface SourceRangeMap {
|
||||||
[key: string]: SourceRange
|
[key: string]: SourceRange
|
||||||
@ -617,6 +621,8 @@ export class EngineCommandManager {
|
|||||||
message.request_id
|
message.request_id
|
||||||
) {
|
) {
|
||||||
this.handleModelingCommand(message.resp, message.request_id)
|
this.handleModelingCommand(message.resp, message.request_id)
|
||||||
|
} else if (!message.success && message.request_id) {
|
||||||
|
this.handleFailedModelingCommand(message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -673,6 +679,38 @@ export class EngineCommandManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
handleFailedModelingCommand({
|
||||||
|
request_id,
|
||||||
|
errors,
|
||||||
|
}: Models['FailureWebSocketResponse_type']) {
|
||||||
|
const id = request_id
|
||||||
|
if (!id) return
|
||||||
|
const command = this.artifactMap[id]
|
||||||
|
if (command && command.type === 'pending') {
|
||||||
|
const resolve = command.resolve
|
||||||
|
this.artifactMap[id] = {
|
||||||
|
type: 'failed',
|
||||||
|
range: command.range,
|
||||||
|
commandType: command.commandType,
|
||||||
|
parentId: command.parentId ? command.parentId : undefined,
|
||||||
|
errors,
|
||||||
|
}
|
||||||
|
resolve({
|
||||||
|
id,
|
||||||
|
commandType: command.commandType,
|
||||||
|
range: command.range,
|
||||||
|
errors,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.artifactMap[id] = {
|
||||||
|
type: 'failed',
|
||||||
|
range: command.range,
|
||||||
|
commandType: command.commandType,
|
||||||
|
parentId: command.parentId ? command.parentId : undefined,
|
||||||
|
errors,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
tearDown() {
|
tearDown() {
|
||||||
this.engineConnection?.close()
|
this.engineConnection?.close()
|
||||||
}
|
}
|
||||||
@ -890,6 +928,8 @@ export class EngineCommandManager {
|
|||||||
}
|
}
|
||||||
if (command.type === 'result') {
|
if (command.type === 'result') {
|
||||||
return command.data
|
return command.data
|
||||||
|
} else if (command.type === 'failed') {
|
||||||
|
return Promise.resolve(command.errors)
|
||||||
}
|
}
|
||||||
return command.promise
|
return command.promise
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user