Skip to content

Commit ddd2f53

Browse files
committed
fix: quick reference being collapsed when clicking an example
1 parent 0ae99f5 commit ddd2f53

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/lib/Debugger.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
flex: 1;
147147
min-height: 150px;
148148
min-width: 300px;
149+
resize: none;
149150
}
150151
}
151152
}

src/lib/Playground.svelte

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
let query: QueryText = $state({ textFormat: props.query })
2727
let debugError: JSONQueryError | null = $state(null)
2828
29+
$effect(() => {
30+
input = props.input
31+
query = { textFormat: props.query }
32+
})
33+
2934
let processedQuery: ProcessedQuery = $derived(processQuery(query))
3035
let output = $derived(go(input, processedQuery))
3136
@@ -328,7 +333,7 @@
328333
border-radius: var(--border-radius);
329334
padding: 5px;
330335
box-sizing: border-box;
331-
font-family: var(--font-family-mono);
336+
font-family: var(--font-family-mono), monospace;
332337
font-size: var(--font-size-mono);
333338
color: inherit;
334339
resize: none;

src/routes/+page.svelte

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import Button from '$lib/Button.svelte'
44
55
const example1 = {
6-
id: 1,
76
input: `{
87
"friends": [
98
{"name": "Chris", "age": 23, "city": "New York"},
@@ -22,7 +21,6 @@
2221
}
2322
2423
const example2 = {
25-
id: 2,
2624
input: `[
2725
{"name": "Chris", "age": 23, "city": "New York"},
2826
{"name": "Emily", "age": 19, "city": "Atlanta"},
@@ -37,7 +35,6 @@
3735
}
3836
3937
const example3 = {
40-
id: 3,
4138
input: example2.input,
4239
query: `map({
4340
firstName: .name,
@@ -50,7 +47,6 @@
5047
}
5148
5249
const example4 = {
53-
id: 4,
5450
input: example2.input,
5551
query: `{
5652
names: map(.name),
@@ -61,7 +57,6 @@
6157
}
6258
6359
const example5 = {
64-
id: 5,
6560
input: `[
6661
{ "name": "bread", "price": 2.5, "quantity": 2 },
6762
{ "name": "milk", "price": 1.2, "quantity": 3 }
@@ -106,9 +101,7 @@
106101
<Button class="example" onclick={() => (example = example5)}>example 5</Button>
107102
</div>
108103
</div>
109-
{#key example.id}
110-
<Playground input={example.input} query={example.query} />
111-
{/key}
104+
<Playground input={example.input} query={example.query} />
112105
</div>
113106

114107
<style>

0 commit comments

Comments
 (0)