`queryOptions` built via currying breaks SolidJS' Reactivity
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Bắt đầu với bản reproduction solid-query-curry-reactivity được liên kết, chuyển sang branch đó, chạy pnpm install và pnpm dev, rồi kiểm tra hành vi RouteComponent được hiển thị. Theo dõi cách kết quả của curried fetchShellData được truyền qua useQuery; được xem là hoàn tất khi query chạy lúc component mount và Switch được render mà không cần truy cập q.data hoặc createMemo().
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
To my knowledge, useQuery is designed so that whenever a component gets mounted (whenever a query key has 1 or more dependent), their queryFn is run (assuming no disabled state / dependent queries, etc).
On SolidJS, creating a queryOption via function currying will result in weird reactivity issue and breaks rendering / hydation code (not sure; TypeError: template is not a function at getNextElement (solid-js_web.js?v=018b852a:792:10) at __root.tsx:57:3...).
One simple reproducible behavior is that query wont be run until you call query.data in a component's body or memoize query.isSuccess in a createMemo().
The following is a reproduction case:
import { queryOptions, useQuery } from "@tanstack/solid-query";
import { createFileRoute } from "@tanstack/solid-router";
import { Match, Switch } from "solid-js";
export const Route = createFileRoute("/")({
component: RouteComponent,
});
export const fetchShellData = (slug: string) =>
queryOptions({
queryKey: ["shell-data", slug],
queryFn: () => {
return `ok: ${slug}`;
},
});
function RouteComponent() {
const opt = fetchShellData("/");
const q = useQuery(() => opt);
return (
<Switch>
<Match when={q.isPending}>PENDING</Match>
<Match when={q.isError}>ERROR</Match>
<Match when={q.isSuccess}>Success: {q.data}</Match>
</Switch>
);
}
Your minimal, reproducible example
https://tangled.org/angelo.fyi/solid-tanplate/tree/solid-query-curry-reactivity
Steps to reproduce
Assuming you've cloned the repo above:
- Switch to
solid-query-curry-reactivitybranch pnpm install&pnpm dev- Visit http://localhost:3000
Expected behavior
I expect that queries will be run automatically on component mount.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: macOS Tahoe 26.4.1
- Browser: Arc Browser - 148.0.7778.168 (Official Build) (arm64)
Tanstack Query adapter
solid-query
TanStack Query version
5.100.11
TypeScript version
4.3.0
Additional context
No response
- Ngôn ngữ chính
- TypeScript
- Star
- 50.4k
- Fork
- 4.2k
- Merge trung bình
- 11 giờ 33 phút
- Pull request đã merge (30 ngày)
- 421
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TanStack/query
-
solid-query: STRICT_READ_UNTRACKED on Solid 2 — client()/options() read in component body (useMutation, useBaseQuery)Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
TanStack/query#11358 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
solid-query: switching the queryClient accessor strands the new client's cache (subscription stays on the old observer)Có thể đã có người làm @MaNaN1803 đã nhận 74 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
TanStack/query#11106 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
-
setQueryData: NoInfer loses discriminated-union members when spreading a narrowed updater valueCó thể đã có người làm @iosayin đã nhận 1 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
-
setQueryData updater loses discriminated-union fields when spreading inferred NoInfer dataCó thể đã có người làm @boriskozak đã nhận 1 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
TanStack/query#11794 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của TanStack/query
Issue tương tự
-
area/dashboard kind/bug QA/dev-automation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
rancher/dashboard#19379 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày
-
perf(core): getComments() runs the approved count and the comment list as two sequential queriesĐang mởarea/core bot:bug bot:working
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
emdash-cms/emdash#3905 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
lingdojo/kana-dojo#31728 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
selective-claw: freshTailTurns=0 keeps ALL turns verbatim and summarizes none (slice(-0) === slice(0))Có thể đã có người làm @zjncs đã nhận hôm nay. Đang mởcomponent:tokenless
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
agentic-os-org/ANOLISA#6112 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
rjsf-team/react-jsonschema-form#5439 ·
Maintainer thường phản hồi trong vòng 1 ngày