[fix] Restore reactJsonViewCompat shim for local dev server#14391
[fix] Restore reactJsonViewCompat shim for local dev server#14391lukasmasuch merged 2 commits intodevelopfrom
Conversation
The direct import from @microlink/react-json-view works in CI but fails when running locally with the hot-reload dev server due to Vite 8 CommonJS interop issues causing "Element type is invalid" errors. Co-Authored-By: Claude Opus 4.6 <[email protected]>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
There was a problem hiding this comment.
Pull request overview
Adds a Vite 8 compatibility shim for @microlink/react-json-view (CommonJS) to ensure the JSON viewer renders reliably across different Vite dependency-optimization module shapes, and updates internal consumers to use the shim.
Changes:
- Introduces
reactJsonViewCompat.tsto normalize nesteddefaultexports viaresolveDefaultExport. - Switches DataFrame JSON cell viewer and the JSON element to import the ReactJson component (and related types) from the compat shim.
- Updates JSON tooltip hook to import
OnSelectPropsfrom the compat shim to keep type usage consistent.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| frontend/lib/src/util/reactJsonViewCompat.ts | New shim to normalize @microlink/react-json-view default export shape under Vite 8. |
| frontend/lib/src/components/widgets/DataFrame/columns/cells/JsonViewer.tsx | Uses the compat ReactJson import for DataFrame JSON cell overlays. |
| frontend/lib/src/components/elements/Json/useJsonTooltip.ts | Imports OnSelectProps from the shim to align with the new import path. |
| frontend/lib/src/components/elements/Json/Json.tsx | Uses the compat ReactJson import and pulls OnCopyProps from the shim. |
Add comprehensive unit tests for the resolveDefaultExport function that handles CommonJS module interop under Vite 8. Tests cover: - Various module shapes (no wrapper, single default, double nested) - Depth limiting behavior - Edge cases (null, undefined, primitives, arrays) This addresses the review feedback requesting test coverage for the compatibility shim to prevent regressions during Vite/dependency upgrades. Co-Authored-By: Claude Opus 4.6 <[email protected]>
SummaryThis PR restores the Changed files:
Code QualityAll three reviewers agreed the code is clean, well-structured, and follows existing codebase patterns. Specific points of consensus:
No blocking code quality issues identified by any reviewer. Test CoverageAll reviewers agreed test coverage is adequate:
Minor gap (non-blocking, noted by gpt-5.3-codex-high): No integration-style test directly verifies Backwards CompatibilityUnanimous agreement: No breaking changes. This restores a previously-existing pattern from the Vite 8 upgrade. The public API and component behavior are unchanged. Type re-exports ( Security & RiskUnanimous agreement: No security concerns.
External test recommendation
AccessibilityUnanimous agreement: No accessibility impact. Rendered DOM and interactive elements are unchanged; only internal import paths are modified. RecommendationsNo blocking issues. Minor non-blocking suggestions from individual reviewers:
VerdictAPPROVED: All three reviewers unanimously approved. The PR is a clean, well-documented restoration of a necessary Vite 8 CommonJS compatibility shim for This is a consolidated AI review by 📋 Review by `gemini-3.1-pro`SummaryThis PR restores the Code QualityThe code quality is excellent. The compatibility shim is well-documented with clear intent, reasoning, and removal criteria. The Test CoverageThe new Backwards CompatibilityThere are no breaking changes. This is a purely internal fix for the development environment and will not affect existing users. Security & RiskNo security concerns or regression risks identified. The changes are isolated to frontend module resolution for a specific component. External test recommendation
AccessibilityNo accessibility impact. The changes only affect module resolution, not the rendered DOM or interactive elements. RecommendationsNone. The changes are solid and ready to merge. VerdictAPPROVED: The PR effectively resolves the local development issue with a robust, well-tested compatibility shim. This is an automated AI review by 📋 Review by `gpt-5.3-codex-high`SummaryThis PR restores a compatibility shim for Code QualityThe change is well-scoped and maintainable:
No blocking code quality issues found. Test CoverageCoverage is good for the utility behavior introduced:
Minor gap (non-blocking): this does not add an integration-style test that directly verifies Backwards CompatibilityNo public API changes or protocol changes are introduced. This is backwards compatible and specifically restores local-dev behavior ( Security & RiskNo security-sensitive surfaces are changed:
Primary risk is limited to JSON component rendering if unexpected module shapes exceed current unwrap depth; current implementation intentionally bounds depth. External test recommendation
AccessibilityNo accessibility-impacting DOM/interaction changes were introduced. This PR only changes import wiring and utility behavior, so existing a11y characteristics remain unchanged. Recommendations
VerdictAPPROVED: The fix is narrowly scoped, addresses the reported local-dev regression, preserves backward compatibility, and introduces adequate utility-level test coverage. This is an automated AI review by 📋 Review by `opus-4.6-thinking`SummaryThis PR restores the Changed files:
Code QualityThe code is clean, well-structured, and follows existing patterns in the codebase:
No issues identified with code structure or maintainability. Test CoverageUnit tests:
E2E tests:
Test coverage is adequate for these changes. Backwards CompatibilityNo breaking changes. This PR restores a pattern that was previously in place (from the Vite 8 upgrade) and only redirects imports through an internal shim. The public API and component behavior are unchanged. The type re-exports ( Security & RiskNo security concerns:
Regression risk: Low. The change only affects how the External test recommendation
AccessibilityNo accessibility impact. The rendered Json components are unchanged — only the internal import path for the RecommendationsNo blocking issues. Minor observations:
VerdictAPPROVED: Clean, well-documented restoration of a necessary Vite 8 CommonJS compatibility shim for This is an automated AI review by |
Describe your changes
Restores the
reactJsonViewCompat.tscompatibility shim that was removed in #14380. The direct import from@microlink/react-json-viewworks in CI builds but fails when running locally with the dev server (e.g.,make debugormake frontend-dev).Changes:
frontend/lib/src/util/reactJsonViewCompat.tswith updated imports for@microlink/react-json-viewJson.tsx,useJsonTooltip.ts, andJsonViewer.tsxto import through the compat shimWhy this is needed:
@microlink/react-json-viewis published as CommonJSmodule,module.default,module.default.default) depending on the optimization pathGitHub Issue Link (if applicable)
react-json-viewto@microlink/react-json-view#14380Testing Plan
make debugto verify Json elements render correctlyContribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
Agent metrics