Replies: 1 comment
-
Instead, we can introduce The workflow above could be implemented by creating a query that returns 'undefined' unless the status === 'done'. const workflowDone = new schema.Query(Workflow, (workflow) => workflow.status === 'done' ? undefined : true); This also enables 'fallback queries' to eliminate the nasty const queryPrice = new schema.Query(
{ ticker: Ticker, stats: Stats },
({ ticker, stats }) => ticker?.price ?? stats?.last,
);
function AssetPrice({ product_id }) {
const price = useQuery(queryPrice, { product_id });
if (!price) return <span></span>;
} const queryPrice = new schema.Query(
{ ticker: Ticker, stats: Stats },
({ ticker, stats }) => ticker?.price ?? stats?.last,
);
function AssetPrice({ product_id }) {
const price = useSuspenseQuery(queryPrice, { product_id });
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This is for long-running tasks that don't resolve from a simple fetch. Endpoint is subscribed (meaning they can use polling or other methods like websockets); then on updates - they check a conditional (function set in endpoint) and if does not pass, throws a promise for next polling frequency.
This will be used for workflow result stream. By using suspense in react 18 the entire flow is very simple - useTransition can simply be used on the workflow button to grab next results.
Beta Was this translation helpful? Give feedback.
All reactions