Two questions relating to implicit ordering. I can obviously verify in code but I;m asking about this from a let's document the guarantee POV, partly so we don't accidentally change the behaviour:
-
Is there an implicit ordering to a collection, such as by insert time or key? For example when a live query doesn't have an orderBy. If so, does this work across synced and optimistic state?
-
Say I have a base collection that's ordered and then I derive a new collection / live query from it:
const { collection: orderedTodos } = useLiveQuery((query) =>
query
.from({ todo: todoCollection })
.orderBy(({ todo }) => todo.inserted_at, 'asc')
)
const { data: pendingTodos } = useLiveQuery((query) =>
query
.from({ todo: orderedTodos })
.where(({ todo }) => eq(todo.completed, false))
)
Is the second collection guaranteed to be in the same order as the first?
Two questions relating to implicit ordering. I can obviously verify in code but I;m asking about this from a let's document the guarantee POV, partly so we don't accidentally change the behaviour:
Is there an implicit ordering to a collection, such as by insert time or key? For example when a live query doesn't have an orderBy. If so, does this work across synced and optimistic state?
Say I have a base collection that's ordered and then I derive a new collection / live query from it:
Is the second collection guaranteed to be in the same order as the first?