clockworklabs / clockworklabs/SpacetimeDB

C# SDK. If I subscribe to changes via a View, updates to rows trigger OnInsert + OnDelete instead of OnUpdate

Open
#4,512 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
25.2k
Forks
1.1k
Avg merge
2d 7h
Merged PRs (30d)
46

Description

I have a public table and a view like that:

[View(Accessor = "MyHeroes", Public = true)]
public static IQuery<Hero> MyHeroes(ViewContext ctx)
{
    return ctx.From.Hero().Where(h => h.Owner.Eq(ctx.Sender));
}

If I subscribe to the public table and update the row, I receive OnUpdate callback.
If I subscribe to the view and update the row, I receive OnInsert + OnDelete callbacks.

Here is how it looks in the logs:

  1. [14:13:59] Create an entry.
  2. [14:14:07] Update it.
Image

Any ideas why subscribing to a View behaves differently from subscribing to a public table?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the C# SDK subscription handling for the shown MyHeroes view and compare it with the public-table subscription path. Reproduce the create-then-update sequence from the issue and inspect the callback logs. Done means updating a row through a subscribed view produces OnUpdate rather than OnInsert plus OnDelete.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.