-
Notifications
You must be signed in to change notification settings - Fork 8.4k
feat: 组件json-viewer支持bigint数据显示 cwy #6377
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
Conversation
|
WalkthroughThe changes update the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant JsonViewerComponent
participant JsonBigint
User->>JsonViewerComponent: Passes JSON string (may contain bigint)
JsonViewerComponent->>JsonBigint: Parses JSON string with storeAsString: true
JsonBigint-->>JsonViewerComponent: Returns parsed JSON (bigints as strings)
JsonViewerComponent->>User: Displays parsed JSON data
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
packages/effects/common-ui/src/components/json-viewer/index.vue (1)
93-100: 💡 Verification agent🧩 Analysis chain
bindProps.valuenow always overrides withjsonData; confirm click-handler consistency
bindPropsfeeds the parsedjsonDatato the underlying viewer, but the click-handler (line 67-69) still uses plainJSON.parse, which cannot round-trip bigint values.
After switching tojson-bigintat the top-level, consider updating that handler too:- param.value = JSON.parse(param.value); + try { + param.value = JSONbig.parse(param.value); + } catch { /* fall back */ }Otherwise the viewer shows correct values while click events emit truncated numbers.
To confirm whether the click handler still uses
JSON.parse(and has not yet been switched toJSONbig.parse), let’s inspect its definition and parsing calls inindex.vue:
🏁 Script executed:
#!/bin/bash # Locate handleClick definition and nearby context rg "function handleClick" -C3 -n packages/effects/common-ui/src/components/json-viewer/index.vue # Search for any JSON.parse calls in this file rg "JSON.parse" -C3 -n packages/effects/common-ui/src/components/json-viewer/index.vue || echo "No JSON.parse calls found" # Check for JSONbig.parse usage (should be present if already updated) rg "JSONbig.parse" -C3 -n packages/effects/common-ui/src/components/json-viewer/index.vue || echo "No JSONbig.parse calls found"Length of output: 988
To ensure consistency with big‐integer support, the click handler must use the same
json-bigintparser as the top‐level binding. Let’s confirm the import name:
🏁 Script executed:
#!/bin/bash # Find how json-bigint is imported in this file rg "import .*json-bigint" -n packages/effects/common-ui/src/components/json-viewer/index.vueLength of output: 135
Update click-handler to use JsonBigint for consistency
The click handler in
packages/effects/common-ui/src/components/json-viewer/index.vuestill does:param.value = JSON.parse(param.value);but the top-level parsing now uses
JsonBigint({ storeAsString: true }), so big integers will be truncated here. Let’s switch the handler to the same parser with a JSON fallback:
- File:
packages/effects/common-ui/src/components/json-viewer/index.vue- Lines: ~67–69
- param.value = JSON.parse(param.value); + try { + param.value = JsonBigint({ storeAsString: true }).parse(param.value); + } catch { + // fall back to native JSON.parse on invalid bigint strings + param.value = JSON.parse(param.value); + }This ensures click events emit full bigint values just like the viewer.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
packages/effects/common-ui/package.json(1 hunks)packages/effects/common-ui/src/components/json-viewer/index.vue(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Lint (ubuntu-latest)
- GitHub Check: Check (windows-latest)
- GitHub Check: Test (windows-latest)
- GitHub Check: Lint (windows-latest)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: post-update (windows-latest)
- GitHub Check: post-update (ubuntu-latest)
🔇 Additional comments (1)
packages/effects/common-ui/package.json (1)
41-45: Pin or document the source for the newly-addedjson-bigintdependency
"json-bigint": "catalog:"follows the same placeholder version strategy as the other deps, but it leaves the actual resolved version opaque.
Given thatjson-bigintis a trans-piled CommonJS package, subtle breaking changes between minor versions could slip in unnoticed. Consider either:
- replacing
catalog:with an explicit semver range ("^1.0.0"is current), or- documenting in the repo how
catalog:is resolved in your internal tooling.This will make reproducible builds and future audits simpler.
2f125f9 to
e1db9e3
Compare
e1db9e3 to
30384ea
Compare
Description
扩展组件:
packages\effects\common-ui\src\components\json-viewer\index.vue支持显示 bigint 数据,如较长的订单号
[{"id":1234567890123456789}]Type of change
Please delete options that are not relevant.
pnpm-lock.yamlunless you introduce a new test example.Checklist
pnpm run docs:devcommand.pnpm test.feat:,fix:,perf:,docs:, orchore:.Summary by CodeRabbit
Summary by CodeRabbit