Open ronitpadariya opened 2 years ago
i have same error, did you found decision?
It's because callWriter
is only if you are nesting writers like shown here: https://nozbe.github.io/WatermelonDB/Writers.html?highlight=callWriter#advanced-nesting-writers-or-readers
If you are not nesting the writer you should follow this part instead: https://nozbe.github.io/WatermelonDB/Writers.html?highlight=callWriter#writer-methods where as you can see they just call the create/update/delete immediately instead of wrapping in a callWriter
.
import { writer } from '@nozbe/watermelondb/decorators'
class Post extends Model {
// ...
@writer async addComment(body, author) {
const newComment = await this.collections.get('comments').create(comment => {
comment.post.set(this)
comment.author.set(author)
comment.body = body
})
return newComment
}
}
Hello @KrisLau, In my app, randomly coming data from the server. In this case, I'm facing this warning.
The writer you're trying to run (unnamed) can't be performed yet, because there are 3 other readers/writers in the queue. Current writer: unnamed. If everything is working fine, you can safely ignore this message (queueing is working as expected). But if your readers/writers are not running, it's because the current writer is stuck. Remember that if you're calling a reader/writer from another reader/writer, you must use callReader()/callWriter(). See docs for more details.
How can I prevent this warning?
If everything is working fine, you can safely ignore this message (queueing is working as expected)
I just ignore it.
When I'm going to update inside callWriter, I 'm facing this error. Please someone tell me how could I call update inside callWriter? Here is my Code.