订购时,Firestore Recycler Adapter不显示新添加的数据

时间:2018-09-29 17:43:17

标签: firebase-realtime-database google-cloud-firestore firebaseui

我有一个查询和一个FirestoreRecyclerAdapter。当查询未排序时,适配器可以工作。它会以随机顺序正确显示结果,当输入新数据时,它会立即显示在新刷新的回收者视图中。

Query query = db.collection(MESSAGES).whereEqualTo(GROUPID, groupid);

    FirestoreRecyclerOptions<MessagesResponse> response = new FirestoreRecyclerOptions.Builder<MessagesResponse>()
    .setQuery(query, MessagesResponse.class)
    .build();

    adapter = new FirestoreRecyclerAdapter<MessagesResponse, MessagesHolder>(response)

但是,当我向查询中添加订单时,它会以正确的顺序正确显示结果,但是当新数据输入到Firestore数据库中时,它不会刷新Recylcer视图。

Query query = db.collection(MESSAGES).whereEqualTo(GROUPID, groupid);
    query = query.orderBy(TIMESTAMP, Query.Direction.ASCENDING);

    FirestoreRecyclerOptions<MessagesResponse> response = new FirestoreRecyclerOptions.Builder<MessagesResponse>()
    .setQuery(query, MessagesResponse.class)
    .build();

    adapter = new FirestoreRecyclerAdapter<MessagesResponse, MessagesHolder>(response)

0 个答案:

没有答案