mirror of
https://github.com/anomalyco/opencode.git
synced 2026-09-03 00:04:47 +00:00
fix(desktop): omit unset browser IPC fields
This commit is contained in:
parent
fec28ef63e
commit
fe1f3c2cdf
2 changed files with 6 additions and 2 deletions
|
|
@ -148,7 +148,7 @@ export function createBrowserPane() {
|
|||
function publishState(entry: Entry, error?: string) {
|
||||
const state = entry.page?.state() ?? null
|
||||
send(entry, { type: "browser.control.state", state })
|
||||
publish(entry, { type: "state", state, error })
|
||||
publish(entry, { type: "state", state, ...(error === undefined ? {} : { error }) })
|
||||
}
|
||||
|
||||
function create(entry: Entry) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,11 @@ export function createDesktopPlatform(
|
|||
return {
|
||||
setLayout(layout) {
|
||||
if (!closed)
|
||||
void ready.then(() => api.browserPane.send({ type: "layout", bindingID, layout })).catch(() => undefined)
|
||||
void ready
|
||||
.then(() =>
|
||||
api.browserPane.send({ type: "layout", bindingID, ...(layout === undefined ? {} : { layout }) }),
|
||||
)
|
||||
.catch(() => undefined)
|
||||
},
|
||||
command: (command) => ready.then(() => api.browserPane.request({ type: "command", bindingID, command })),
|
||||
close() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue