update some naming

This commit is contained in:
Peter Clement 2025-02-12 12:20:37 +00:00
parent af0c722af1
commit 5ca1f17d74
4 changed files with 7 additions and 11 deletions

View File

@ -8,7 +8,7 @@
TooltipPosition,
} from "@budibase/bbui"
import { previewStore, selectedScreen } from "@/stores/builder"
import { ComponentContext } from "@budibase/types"
import type { ComponentContext } from "@budibase/types"
export let baseRoute = ""
@ -65,7 +65,7 @@
}
const onVariableChange = (e: CustomEvent) => {
previewStore.updateUrl({ route: baseRoute, testValue: e.detail })
previewStore.setUrlTestData({ route: baseRoute, testValue: e.detail })
}
onMount(() => {
@ -91,11 +91,7 @@
<Input disabled={true} value={baseInput} />
</div>
<div class="variable-input">
<Input
value={testValue}
on:change={onVariableChange}
placeholder={`${placeholder}`}
/>
<Input value={testValue} on:change={onVariableChange} {placeholder} />
</div>
</div>
</div>

View File

@ -85,8 +85,8 @@ export class PreviewStore extends BudiStore<PreviewState> {
this.sendEvent("builder-state", data)
}
updateUrl(data: Record<string, any>) {
this.sendEvent("builder-test-url", data)
setUrlTestData(data: Record<string, any>) {
this.sendEvent("builder-url-test-data", data)
}
requestComponentContext() {

View File

@ -109,7 +109,7 @@ const loadBudibase = async () => {
} else if (type === "builder-state") {
const [[key, value]] = Object.entries(data)
stateStore.actions.setValue(key, value)
} else if (type === "builder-test-url") {
} else if (type === "builder-url-test-data") {
const { route, testValue } = data
routeStore.actions.setTestUrlParams(route, testValue)
}

View File

@ -127,7 +127,7 @@ const createRouteStore = () => {
const [pathPart, queryPart] = testValue.split("?")
const routeSegments = route.split("/").filter(Boolean)
// If first segment is a parameter (e.g. /:foo), include it in processing
// If first segment happens to be a parameter (e.g. /:foo), include it
const startIndex = routeSegments[0]?.startsWith(":") ? 0 : 1
const segments = routeSegments.slice(startIndex)
const testSegments = pathPart.split("/")