Skip to content

Add a new sync/4 callback to include operations - #4

Merged
michaelst merged 3 commits into
devhub-tools:mainfrom
brsntus:add-operation-to-sync
Oct 23, 2025
Merged

Add a new sync/4 callback to include operations#4
michaelst merged 3 commits into
devhub-tools:mainfrom
brsntus:add-operation-to-sync

Conversation

@brsntus

@brsntus brsntus commented Oct 23, 2025

Copy link
Copy Markdown
Contributor

This introduces a new optional sync/4 callback, that receives a list or atom indicating the operation(s) being performed.

By default, sync/3 will be called, and sync/4 will only be called if it's available.

We can mix sync/3 and sync/4 in the same file, as long as the watched key is different.

When watching a list of records, operations will be a keyword list of [operation: %Record{}], where operation is one of :insert, :update or :delete.

When watching on a single record, operation will be a single atom.

Comment thread lib/live_sync/socket.ex Outdated
@michaelst
michaelst merged commit d6ad922 into devhub-tools:main Oct 23, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants