-
Notifications
You must be signed in to change notification settings - Fork 152
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationquestionFurther information is requestedFurther information is requested
Description
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?
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationquestionFurther information is requestedFurther information is requested