fix: persisting collapsed state of portals

pull/8825/head
Konstantinos Kaloutas 2023-03-08 16:33:40 +02:00 committed by Gabriel Horner
parent 874b4d9f9a
commit 7a889a042b
1 changed files with 1 additions and 9 deletions

View File

@ -146,20 +146,11 @@ export class LogseqPortalShape extends TLBoxShape<LogseqPortalShapeProps> {
this.update({ compact: collapsed }) this.update({ compact: collapsed })
this.canResize[1] = !collapsed this.canResize[1] = !collapsed
if (!collapsed) { if (!collapsed) {
// this will also persist the state, so we can skip persist call
await delay()
this.onResetBounds() this.onResetBounds()
} }
this.persist?.()
} else { } else {
const originalHeight = this.props.size[1] const originalHeight = this.props.size[1]
this.canResize[1] = !collapsed this.canResize[1] = !collapsed
console.log(
collapsed,
collapsed ? this.getHeaderHeight() : this.props.collapsedHeight,
this.getHeaderHeight(),
this.props.collapsedHeight
)
this.update({ this.update({
isAutoResizing: !collapsed, isAutoResizing: !collapsed,
collapsed: collapsed, collapsed: collapsed,
@ -167,6 +158,7 @@ export class LogseqPortalShape extends TLBoxShape<LogseqPortalShapeProps> {
collapsedHeight: collapsed ? originalHeight : this.props.collapsedHeight, collapsedHeight: collapsed ? originalHeight : this.props.collapsedHeight,
}) })
} }
this.persist?.()
} }
@computed get scaleLevel() { @computed get scaleLevel() {