Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure messages are deduplicated based on model id #205

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/widgets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
type Receiver = any
type Fragment = any
type HasProps = any
type Ref = any

const { keys, values } = Object

Expand All @@ -29,20 +28,24 @@
div: string
}

export interface Ref {

Check warning on line 31 in src/widgets.ts

View workflow job for this annotation

GitHub Actions / build

Interface name `Ref` must match the RegExp: /^I[A-Z]/u
id: string
}

export interface DocumentChanged {

Check warning on line 35 in src/widgets.ts

View workflow job for this annotation

GitHub Actions / build

Interface name `DocumentChanged` must match the RegExp: /^I[A-Z]/u
event: 'jsevent'
kind: string
}

export interface ModelChanged extends DocumentChanged {

Check warning on line 40 in src/widgets.ts

View workflow job for this annotation

GitHub Actions / build

Interface name `ModelChanged` must match the RegExp: /^I[A-Z]/u
event: 'jsevent'
kind: 'ModelChanged'
id: string
model: Ref
new: unknown
attr: string
}

export interface MessageSent extends DocumentChanged {

Check warning on line 48 in src/widgets.ts

View workflow job for this annotation

GitHub Actions / build

Interface name `MessageSent` must match the RegExp: /^I[A-Z]/u
event: 'jsevent'
kind: 'MessageSent'
msg_data: {
Expand Down Expand Up @@ -169,7 +172,7 @@
if (new_msg.kind != msg.kind) {
new_msgs.push(msg)
} else if (msg.kind == 'ModelChanged' && new_msg.kind == 'ModelChanged') {
if (msg.id != new_msg.id || msg.attr != new_msg.attr) {
if (msg.model.id != new_msg.model.id || msg.attr != new_msg.attr) {
new_msgs.push(msg)
}
} else if (msg.kind == 'MessageSent' && new_msg.kind == 'MessageSent') {
Expand Down
Loading