Skip to content

Query with linkMany does not provide value if there are no entities in ToMany relation #403

Closed
@orestesgaolin

Description

@orestesgaolin

Basic info (please complete the following information):

  • ObjectBox version: 1.4.1
  • Flutter/Dart SDK: 2.10.3
  • Null-safety enabled: yes
  • Reproducibility: yes, sample available here
  • OS: Android, iOS, macOS
  • Device/Emulator: n/a

Steps to reproduce

Example available here

  1. Add several attachments to the first note by clicking on the attachment icon, don't add them to other notes

screenshot_2022-03-23_13 36 43

  1. Update query for a Note entity that has ToMany relation using ..linkMany(Entitiy_.relation)
  ObjectBox._create(this.store) {
    noteBox = Box<Note>(store);

    final qBuilder = noteBox.query()
      ..order(Note_.date, flags: Order.descending)
      // Comment to see it working
      ..linkMany(Note_.attachment);
    queryStream = qBuilder.watch(triggerImmediately: true);

    // Add some demo data if the box is empty.
    if (noteBox.isEmpty()) {
      _putDemoData();
    }
  }
  1. Hot restart the app
  2. Observe that it doesn't emit values which have no entities in the above relation

screenshot_2022-03-23_13 37 09

  1. Comment out line 23 in objectbox.dart file, hot restart the app, and observe this entity to be shown again

Expected behavior

Query using .linkMany should emit values also when there are no entities in the ToMany relation

Code

Sample available here https://github.com/objectbox/objectbox-dart/pull/402/files

Metadata

Metadata

Assignees

No one assigned

    Labels

    more info requiredNeeds more info to become actionable. Auto-closed if no response.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions