@json-layout/core 0.16.1 → 0.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@json-layout/core",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "Compilation and state management utilities for JSON Layout.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -319,6 +319,14 @@ export function createStateNode (
319
319
  /** @type {number} */
320
320
  const activeChildTreeIndex = fullKey in context.activeItems ? context.activeItems[fullKey] : skeleton.childrenTrees?.findIndex((childTree) => compiledLayout.validates[childTree.root.pointer](data))
321
321
  if (activeChildTreeIndex !== -1) {
322
+ context.errors = context.errors?.filter(error => {
323
+ const originalError = error.params?.errors?.[0] ?? error
324
+ // if an item was selected, remove the oneOf error
325
+ if (originalError.schemaPath === skeleton.pointer && originalError.keyword === 'oneOf') return false
326
+ // also remove the errors from other children of the oneOf
327
+ if (!originalError.schemaPath.startsWith(skeleton.pointer + '/' + activeChildTreeIndex)) return false
328
+ return true
329
+ })
322
330
  context.activeItems = produce(context.activeItems, draft => { draft[fullKey] = activeChildTreeIndex })
323
331
  const activeChildKey = `${fullKey}/${activeChildTreeIndex}`
324
332
  if (context.autofocusTarget === fullKey) context.autofocusTarget = activeChildKey