Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

predicate doesn't work on modified #60

Open
mocha-coffee-jp opened this issue Mar 22, 2019 · 0 comments
Open

predicate doesn't work on modified #60

mocha-coffee-jp opened this issue Mar 22, 2019 · 0 comments

Comments

@mocha-coffee-jp
Copy link

mocha-coffee-jp commented Mar 22, 2019

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条件が外れる変更だった場合も考慮するべき?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant