dart_meteor icon indicating copy to clipboard operation
dart_meteor copied to clipboard

meteor.collection.listen it return wrong result

Open u-sour opened this issue 7 months ago • 0 comments

hi @tanutapi , i just test meteor.collection.listen it return wrong result after i change value args on meteor.subscribe it doesn't filter by new value of args, any idea ?

here what i did

  late SubscriptionHandler? _subDepartmentHandler;
  SubscriptionHandler? get subDepartmentHandler => _subDepartmentHandler;

// change branch method
void setBranch({required BranchModel branch}) {
     _subDepartmentHandler!.stop();
     startSubscribeDepartment(branchId: branch.id);
    notifyListeners();
  }

 void startSubscribeDepartment({required String branchId}) {
    Map<String, dynamic> selector = {};
      selector['branchId'] = branchId;
   
    // subscribe department
    _subDepartmentHandler =
        meteor.subscribe('rest.department', args: [selector], onReady: () {
          meteor.collection('rest_departments').listen((result) {
            print(result.values.toList()) <------ wrong result it get all records form collection without filter by args on meteor.subscribe
      });
    });
  }

u-sour avatar Jul 15 '24 04:07 u-sour