Skip to content

Commit

Permalink
Do not drop events while blocked
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Apr 18, 2024
1 parent 38d8fd5 commit d1c47df
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/widgets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class BokehView extends DOMWidgetView {
private _receiver: Receiver
private _blocked: boolean
private _msgs: any[]
private _events: any[]
private _idle: boolean
private _combine: boolean

Expand Down Expand Up @@ -175,7 +176,7 @@ export class BokehView extends DOMWidgetView {
if (
msg.msg_data.event_values.model == null ||
msg.msg_data.event_values.model.id !=
new_msg.msg_data.event_values.model.id ||
new_msg.msg_data.event_values.model.id ||
msg.msg_data.event_name != new_msg.msg_data.event_name
) {
new_msgs.push(msg)
Expand All @@ -198,6 +199,7 @@ export class BokehView extends DOMWidgetView {

protected _change_event(event: DocumentChangedEvent): void {
if (this._blocked) {
this._events.push(event)
return
}
const { Serializer } = bk_require('core/serialization')
Expand Down Expand Up @@ -228,6 +230,11 @@ export class BokehView extends DOMWidgetView {
this._document.apply_json_patch(comm_msg.content, comm_msg.buffers)
} finally {
this._blocked = false
const events = [...this._events]

Check failure on line 233 in src/widgets.ts

View workflow job for this annotation

GitHub Actions / build

Mixed spaces and tabs
this._events = []

Check failure on line 234 in src/widgets.ts

View workflow job for this annotation

GitHub Actions / build

Mixed spaces and tabs
for (const event of this._events) {

Check failure on line 235 in src/widgets.ts

View workflow job for this annotation

GitHub Actions / build

Mixed spaces and tabs
this._change_event(event)

Check failure on line 236 in src/widgets.ts

View workflow job for this annotation

GitHub Actions / build

Mixed spaces and tabs
}

Check failure on line 237 in src/widgets.ts

View workflow job for this annotation

GitHub Actions / build

Mixed spaces and tabs
}
}
}
Expand Down

0 comments on commit d1c47df

Please sign in to comment.