Repository navigation
Commit a77b15e
committed
fix:
**The Issue:** The `OneOfRenderer.spec.ts` test suite uses a minimal
schema that only contains a `oneOf` property. When
`CombinatorProperties.vue` mounts, it exctracts properties to generate a
UI schema by omitting the combinator keyword (`omit(props.schema,
props.combinatorKeyword)`), which in this test case results in an
entirely empty object.
**The Crash:** When this empty object is passed into
`Generate.uiSchema()`, the generator finds no properties and returns a
falsy value (null/undefined). The component's internal `isLayout` type
guard then immediately executed
`Object.prototype.hasOwnProperty.call(uischema, 'elements')`. Passing
`null` to `hasOwnProperty` threw a hard `TypeError: Cannot convert
undefined or null to object`, crashing the component mount phase.
**The Fix:** In `CombinatorProperties.vue`, I explicitly typed the
generator output to acknowledge it can return `null` and updated the
`isLayout` type guard to safely accept `unknown` inputs. The guard now
ensures `uischema !== null` and `typeof uischema === 'object'` before
attempting to check for the `elements` property.TypeError in CombinatorProperties.vue
1 parent b67f804 commit a77b15e
1 file changed
Lines changed: 13 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
62 | | - | |
| 64 | + | |
63 | 65 | | |
64 | | - | |
65 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
66 | 71 | | |
| 72 | + | |
67 | 73 | | |
68 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
69 | 77 | | |
70 | 78 | | |
71 | 79 | | |
| |||
0 commit comments