"Cannot stringify arbitrary non-POJOs" error in Nuxt projects
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
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- nuxtjs, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Tái hiện lỗi bằng lệnh trình tạo Nuxt và trang Animal được tạo. Kiểm tra nuxt.config.js, ./nuxt/stores/animal/list.ts và ./composables/api.ts, đồng thời so sánh các workaround payload và shallowRef được đề xuất. Được xem là hoàn tất khi một client Nuxt 3.4+ được tạo có thể tải tài nguyên mà không gặp lỗi “Cannot stringify arbitrary non-POJOs”.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
API Platform version(s) affected: 3.2.18
Description
Clients generated for Nuxt will fail with: "Cannot stringify arbitrary non-POJOs"
How to reproduce
- Create an Entity e.g. "Animal"
- Create a Nuxt project
- Create a client (e.g.
yarn create @api-platform/client https://localhost/ . --generator nuxt --resource animal) - Load https://localhost/animal
You'll get a message saying: "Cannot stringify arbitrary non-POJOs"
Possible Solution
- One solution is to edit
nuxt.config.jsand add the following:
experimental: {
renderJsonPayloads: false,
},
- Another possible solution is to edit
./nuxt/stores/animal/list.tsand addshallowRef()tosetHubUrlfunction:
setHubUrl(hubUrl?: URL) {
this.hubUrl = shallowRef(hubUrl);
},
- Another solution is to edit
./composables/api.tsand addshallowRef() to allonResponse()` functions.
Additional Context
This is occurring with all projects using Nuxt 3.4 or later.
More info at: https://nuxt.com/blog/v3-4#payload-enhancements
- Ngôn ngữ chính
- TypeScript
- Star
- 376
- Fork
- 132
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không 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 api-platform/create-client
-
[potential Security Alert] New `test-vue-app` script added in `@api-platform/[email protected]`Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
api-platform/create-client#396 ·
-
[potential Security Alert] New `test-nuxt-app` script added in `@api-platform/[email protected]`Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
api-platform/create-client#397 ·
-
[potential Security Alert] New `test-next-app` script added in `@api-platform/[email protected]`Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
api-platform/create-client#395 ·
-
[potential Security Alert] New `test-react-app` script added in `@api-platform/[email protected]`Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
api-platform/create-client#394 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
api-platform/create-client#393 · 1 bình luận ·
Tất cả issue của api-platform/create-client
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
area:cowork area:desktop documentation enhancement platform:macos
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
anthropics/claude-code#101720 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
apache/rocketmq-dashboard#6610 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Add: MS NOWĐang mởcheck:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Global update drops overrideAccess, so Local API updateGlobal fails filterOptions validation (3.90 regression)Có thể đã có người làm @PINYOPATTANAWASANPORN đã nhận hôm nay. Đang mởarea: core Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
payloadcms/payload#18674 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày