Open nemo opened 5 years ago
@nemo This is an extremely general bug description, and I don't believe I am understanding. Data is not ever populated within state, it is populated as you get it out of state using populate
. Could you provide more description of what you are trying to accomplish as well as some code to reproduce (including version of dependencies)?
So in this scenario, I would expect _venue
on the poets
collection to be populated:
const PoetsList = compose(
firestoreConnect((props, state) => [
{
collection: 'poets',
orderBy: ['name'],
limit: 1000,
populates: [{ child: '_venue', root: 'venues' }],
storeAs: 'orderedPoets'
}
]),
connect((state, props) => ({
poets: state.firestore.ordered.orderedPoets || []
}))
)(Poets)
However – it's not, because I can't use the populate
function (like below) to populate the ordered version of the query results. But the following scenario works (since we can use populate, but obviously we lose the order):
const PoetsList = compose(
firestoreConnect((props, state) => [
{
collection: 'poets',
orderBy: ['name'],
limit: 1000,
populates: [{ child: '_venue', root: 'venues' }],
storeAs: 'orderedPoets'
}
]),
connect((state, props) => ({
poets: populate(state.firestore, 'orderedPoets', [{ child: '_venue', root: 'venues' }])
}))
)(Poets)
Does that make sense? Or maybe I just don't know how to use populate
with the ordered
data state.
@nemo As you show in the second example there, you need to use populate
to get populated data out. It does not currently support ordered data. Since the data needed to do the population is queried for by placing populates
on the query setting, you can build the populated result manually from data out of state.
That said, it would be good to support ordered population, so lets have this ticket be a tracking of that feature 😄
Yes – that's really what I've been trying to say, but utterly failing at it. I want populate
to support ordered population :P
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
ordered data isn't populated
What is the expected behavior?
oredered data to be populated.
Which versions of dependencies, and which browser are affected by this issue? Did this work in previous versions or setups?
Never worked.
Steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar.
Populate a collection and look at state.firestore.ordered.