fix(desktop): omit unset browser IPC fields

This commit is contained in:
LukeParkerDev 2026-09-01 10:12:25 +10:00
parent fec28ef63e
commit fe1f3c2cdf
2 changed files with 6 additions and 2 deletions

View file

@ -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) {

View file

@ -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() {