Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

computed fields breaking studio

Đang mở
#2,862 4 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@jiashengguo đang làm issue này rồi.

Từ ngày 8/10/2026.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
27/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ệ
nodejs, postgresql, typescript
Lĩnh vực
tooling

Hướng nghiên cứu

The reporter's computed fields live in their computedFields.ts as a Kysely-style SQL resolver, and API queries work; only Studio's proxy runtime fails. Read where Studio constructs its proxy Prisma client and where the computed-fields plugin/handler is registered, then reproduce with the Bid, BidSubmission, Project and Opportunity models on PostgreSQL. Done means Studio resolves computed fields, or the limitation is documented with a test covering the proxy path.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description and expected behavior
Yes, this appears to be a ZenStack Studio limitation/bug.

Your computed fields work perfectly at the API level (we proved this), but Studio's proxy runtime doesn't have access to the SQL implementations in computedFields.ts, so it can't display them.

What's Working ✅
Computed field definitions in schema
SQL resolver implementations
API queries return correct values
Application runtime has everything it needs
What's Not Working ❌
Studio UI proxy - can't resolve computed fields
Studio tables for Bid, BidSubmission, Project, Opportunity models
Recommendation
Since the API works perfectly and that's what your app uses, this is safe to ignore for now. If you need to browse data with computed fields:

Use the test script: pnpm run test:computed-fields
Or query the API directly
Studio's lack of computed field display is a presentation issue, not a data issue
Consider reporting this to ZenStack if you haven't already - they should support computed fields in Studio.
Screenshots

Image

Environment (please complete the following information):

  • ZenStack version: [e.g., 3.9.7]
  • Database type: Postgresql
  • Node.js/Bun version: v26.8.2
  • Package manager: pnpm

Additional context

I am writing computed fields like this as kysely doesnt work

// The baseTotalPrice is a computed field that calculates the total price of the bid based on the related estimates. It sums up the product of quantity and unitPrice for all EstimateLineItems associated with the bid, providing a dynamic calculation of the bid's total value. Returns 0 if no estimates exist.
baseTotalPrice: (_eb, { modelAlias }) => {
const bidIdRef = sql.ref(${modelAlias}.id)

  return sql<number>`COALESCE((
    SELECT COALESCE(SUM("EstimateLineItem"."quantity" * "EstimateLineItem"."unitPrice"), 0)
    FROM "EstimateLineItem"
    INNER JOIN "Estimate" ON "EstimateLineItem"."estimateId" = "Estimate"."id"
    WHERE "Estimate"."bidId" = ${bidIdRef}
  ), 0)`
},
Ngôn ngữ chính
TypeScript
Star
2.9k
Fork
157
Merge trung bình
2 ngày 46 phút
Pull request đã merge (30 ngày)
17

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của zenstackhq/zenstack

Tất cả issue của zenstackhq/zenstack

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.