Skip to content

Subscriptions do not trigger when creating related data indirectly #631

@KiddoV

Description

@KiddoV

Description

When using Brick’s subscriptions, changes to a table only fire when rows are inserted/updated in that table. If you create a related object indirectly by only inserting rows into a join or child table, the subscription on the parent table does not trigger.

Example (conceptual):

  • You have a Parent table and a Child table with a foreign key to Parent.
  • You subscribe to Parent changes:
appDB.subscribe<Parent>().listen((parents) {
 print("Parent updated!");
});
  • Instead of inserting a row into Parent directly, you insert only into Child with a reference to a new parent ID.
final parent = Parent(id: "p1", name: "Parent A");
await appDB.upsert<Child>(Child(id: "c1", parent: parent));

Observed behavior:

The subscription on Parent never fires.

Expected behavior

Subscriptions on Parent should ideally detect changes to related children if the parent object is conceptually modified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions