Skip to content

predicate doesn't work on modified #60

@mocha-coffee-jp

Description

@mocha-coffee-jp

Step 1: Describe your environment

  • Xcode version:10.1
  • Pring version: 0.16.1

Step 3: Describe the problem

Steps to reproduce:

  1. Create User and Save
let user: User = User()
user.name = "hoge"
user.save()
  1. Create Option and set predicate.
let option = Options()
option.predicate = NSPredicate(format: "name == %@", "moge")
  1. Create DataSource
  let dataSource = UserInfo.dataSource(options: option)
     .on({ [weak self] (snapshot, changes) in
            switch changes {
                case .initial:
                    ()
                case .update(let deletions, let insertions, let modifications):
                    ()
                case .error(let error):
                    print(error)
                }
      }).listen()
  1. Update UserName
    Update User.name "hoge" to "moge" at FireStore

  2. now is user.name = "moge", but never call changes or add event.

Relevant Code:

DataSource.swift - line 305

func _operate() {
   case .modified: 
      guard self.documents.contains(where: { return $0.id == id}) else {
         return
      }
}

Should consider about currently not contains items?
ここでfilterd条件が外れる変更だった場合も考慮するべき?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions