From 0e5a31db9f2b232baed5b475cdd5052f1923cad1 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 6 Feb 2024 10:21:05 +0300 Subject: [PATCH] Hot fix for observable meta wrapper --- .../space/kscience/dataforge/meta/ObservableMetaWrapper.kt | 4 ++-- .../space/kscience/dataforge/meta/ObservableMetaTest.kt | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/ObservableMetaWrapper.kt b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/ObservableMetaWrapper.kt index 71e15aa9..abd2deb6 100644 --- a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/ObservableMetaWrapper.kt +++ b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/ObservableMetaWrapper.kt @@ -15,9 +15,9 @@ private class ObservableMetaWrapper( val listeners: MutableSet, ) : ObservableMutableMeta { override val items: Map - get() = root.items.keys.associateWith { + get() = root[nodeName]?.items?.keys?.associateWith { ObservableMetaWrapper(root, nodeName + it, listeners) - } + } ?: emptyMap() override fun get(name: Name): ObservableMutableMeta? = if (root[nodeName + name] == null) { null diff --git a/dataforge-meta/src/commonTest/kotlin/space/kscience/dataforge/meta/ObservableMetaTest.kt b/dataforge-meta/src/commonTest/kotlin/space/kscience/dataforge/meta/ObservableMetaTest.kt index 4681ec12..2d6cc36f 100644 --- a/dataforge-meta/src/commonTest/kotlin/space/kscience/dataforge/meta/ObservableMetaTest.kt +++ b/dataforge-meta/src/commonTest/kotlin/space/kscience/dataforge/meta/ObservableMetaTest.kt @@ -17,6 +17,8 @@ class ObservableMetaTest { } }.asObservable() + println(meta) + assertEquals("scatter", meta["data.type"].string) }