fix: use selected runtime types on runtime and viewFn queries (#177)

This commit is contained in:
Victor Oliva
2026-08-07 11:45:37 +02:00
committed by GitHub
parent 7efd6f947c
commit 040dae8920
3 changed files with 14 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
import { runtimeCtx$ } from "@/state/chains/chain.state"
import { cn } from "@/lib/utils"
import { selectedBlock$ } from "@/pages/Storage/BlockPicker"
import { byteArraysAreEqual } from "@/utils/byteArray"
import {
CodecComponentType,
@@ -20,10 +21,10 @@ import { EditCodec } from "../EditCodec"
import { TreeCodec } from "../EditCodec/Tree"
import { BinaryDisplay } from "./BinaryDisplay"
import { FocusPath } from "./FocusPath"
import { cn } from "@/lib/utils"
const editTypeMetadataProps$ = state(
runtimeCtx$.pipe(
selectedBlock$.pipe(
map(({ ctx }) => ctx),
map(({ dynamicBuilder, lookup }) => ({
builder: dynamicBuilder,
metadata: lookup.metadata,

View File

@@ -5,7 +5,7 @@ import {
import { ActionButton } from "@/components/ActionButton"
import { ExpandBtn } from "@/components/Expand"
import { useNavigate } from "@/hashParams"
import { client$, dynamicBuilder$, lookup$ } from "@/state/chains/chain.state"
import { client$, dynamicBuilder$ } from "@/state/chains/chain.state"
import { getTypeComplexity } from "@/utils/shape"
import { state, useStateObservable, withDefault } from "@react-rxjs/core"
import { createSignal } from "@react-rxjs/utils"
@@ -141,7 +141,10 @@ const inputValue$ = state(
(idx: number) => inputValues$.pipe(map((v) => v[idx])),
null,
)
const lookupState$ = state(lookup$, null)
const lookupState$ = state(
selectedBlock$.pipe(map(({ ctx }) => ctx.lookup)),
null,
)
const RuntimeValueInput: FC<{ idx: number; name: string; type: number }> = ({
idx,
type,

View File

@@ -5,7 +5,7 @@ import {
import { ActionButton } from "@/components/ActionButton"
import { ExpandBtn } from "@/components/Expand"
import { useNavigate } from "@/hashParams"
import { client$, dynamicBuilder$, lookup$ } from "@/state/chains/chain.state"
import { client$, dynamicBuilder$ } from "@/state/chains/chain.state"
import { getTypeComplexity } from "@/utils/shape"
import { state, useStateObservable, withDefault } from "@react-rxjs/core"
import { createSignal } from "@react-rxjs/utils"
@@ -138,7 +138,10 @@ const inputValue$ = state(
(idx: number) => inputValues$.pipe(map((v) => v[idx])),
null,
)
const lookupState$ = state(lookup$, null)
const lookupState$ = state(
selectedBlock$.pipe(map(({ ctx }) => ctx.lookup)),
null,
)
const RuntimeValueInput: FC<{ idx: number; name: string; type: number }> = ({
idx,
type,