Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order not working in useQuery #871

Closed
ahrorbeksoft opened this issue Feb 14, 2025 · 3 comments
Closed

Order not working in useQuery #871

ahrorbeksoft opened this issue Feb 14, 2025 · 3 comments

Comments

@ahrorbeksoft
Copy link

I am having trouble ordering inside queries

here is my query:

	const { data, isLoading } = db.useQuery({
		leadColumns: {
			$: {
				where: {
					branch: branchId,
				},
				order: {
					order: "asc",
				},
			},
		},
	} satisfies InstaQLParams<AppSchema>);

i have leadColumns namespace with order attribute which is a number type, but when add order inside the query results do not show up at all, when i remove it is fetching data

@olegkorol
Copy link

Is your order attribute indexed, @ahrorbeksoft?

i.e.

const schema = {
// ...
  order: i.number().indexed(),
// ...
}

@stopachka
Copy link
Contributor

@ahrorbeksoft

Do you see any errors in the inspector, or does an error message come back from the query?

@ahrorbeksoft
Copy link
Author

Is your order attribute indexed, @ahrorbeksoft?

i.e.

const schema = {
// ...
order: i.number().indexed(),
// ...
}

thanks, it started working after i added indexed() for order attributes. thank a lot. so for every attribute that is used inside $ object should be indexed then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants