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

Introduce Optional Query #95

Merged
merged 1 commit into from
Sep 16, 2024
Merged

Introduce Optional Query #95

merged 1 commit into from
Sep 16, 2024

Conversation

ogaclejapan
Copy link
Contributor

The popular TanStack Query library in the React ecosystem has a feature known as Dependent Query.

Currently, Soil Query does not have an API for conditionally executing queries. Therefore, we have implemented the Optional Query feature to enable queries based on certain conditions, such as the results of other queries.

Previously, developers could achieve similar functionality by manually implementing conditional branching, but this new feature can replace that approach.

val query = rememberQueryIf(someValue, keyFactory = { someValue -> if (someValue.isEnabled) SomeQueryKey() else null })

The popular TanStack Query library in the React ecosystem has a feature known as [Dependent Query](https://tanstack.com/query/v5/docs/framework/react/guides/dependent-queries).

Currently, Soil Query does not have an API for conditionally executing queries. Therefore, we have implemented the
Optional Query feature to enable queries based on certain conditions, such as the results of other queries.

Previously, developers could achieve similar functionality by manually implementing conditional branching, but this new
feature can replace that approach.
@ogaclejapan ogaclejapan added the enhancement New feature or request label Sep 16, 2024
@ogaclejapan ogaclejapan merged commit 2eed406 into main Sep 16, 2024
3 checks passed
@ogaclejapan ogaclejapan deleted the optional-query branch September 16, 2024 04:40
ogaclejapan added a commit that referenced this pull request Sep 16, 2024
The Symbol class has been implemented to represent null values for `DataModel<T>`. With the recent addition of Optional
Query, there have been instances where a `QueryObject` can be nullable. To address this, a fallback function has been
included in the runtime package module.

refs: #95
@github-actions github-actions bot mentioned this pull request Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant