tangled
alpha
login
or
join now
danabra.mov
/
rscexplorer
37
fork
atom
A tool for people curious about the React Server Components protocol
rscexplorer.dev/
rsc
react
37
fork
atom
overview
issues
pulls
pipelines
make samples more mobile-friendly
danabra.mov
2 months ago
b76404ec
b53a6096
+19
-13
3 changed files
expand all
collapse all
unified
split
src
client
samples.ts
tests
bound.spec.ts
refresh.spec.ts
+6
-6
src/client/samples.ts
···
99
99
<input
100
100
name="name"
101
101
placeholder="Enter your name"
102
102
-
style={{ padding: '8px 12px', borderRadius: 4, border: '1px solid #ccc' }}
102
102
+
style={{ flex: 1, minWidth: 0, padding: '8px 12px', borderRadius: 4, border: '1px solid #ccc' }}
103
103
/>
104
104
<button disabled={isPending}>
105
105
{isPending ? 'Sending...' : 'Greet'}
···
177
177
178
178
return (
179
179
<div style={{ opacity: isPending ? 0.7 : 1 }}>
180
180
-
{content}
181
181
-
<button onClick={refresh} disabled={isPending} style={{ marginTop: 12 }}>
180
180
+
<button onClick={refresh} disabled={isPending} style={{ marginBottom: 12 }}>
182
181
{isPending ? 'Refreshing...' : 'Refresh'}
183
182
</button>
183
183
+
{content}
184
184
</div>
185
185
)
186
186
}`,
···
409
409
}
410
410
411
411
return (
412
412
-
<form action={handleSubmit} style={{ marginBottom: 8 }}>
413
413
-
<input name="name" placeholder="Your name" required />
412
412
+
<form action={handleSubmit} style={{ display: 'flex', gap: 8, alignItems: 'center', marginBottom: 8 }}>
413
413
+
<input name="name" placeholder="Your name" required style={{ flex: 1, maxWidth: 120, minWidth: 0, padding: '4px 8px' }} />
414
414
<button>Greet</button>
415
415
-
{result && <span style={{ marginLeft: 8 }}>{result}</span>}
415
415
+
{result && <span>{result}</span>}
416
416
</form>
417
417
)
418
418
}`,
+12
-6
tests/bound.spec.ts
···
105
105
106
106
Same action, different bound greetings:
107
107
108
108
-
GreetHello, Alice!
108
108
+
Greet
109
109
+
Hello, Alice!
109
110
Greet
110
111
Greet"
111
112
`,
···
119
120
120
121
Same action, different bound greetings:
121
122
122
122
-
GreetHello, Alice!
123
123
-
GreetHowdy, Bob!
123
123
+
Greet
124
124
+
Hello, Alice!
125
125
+
Greet
126
126
+
Howdy, Bob!
124
127
Greet"
125
128
`,
126
129
);
···
133
136
134
137
Same action, different bound greetings:
135
138
136
136
-
GreetHello, Alice!
137
137
-
GreetHowdy, Bob!
138
138
-
GreetHey, Charlie!"
139
139
+
Greet
140
140
+
Hello, Alice!
141
141
+
Greet
142
142
+
Howdy, Bob!
143
143
+
Greet
144
144
+
Hey, Charlie!"
139
145
`,
140
146
);
141
147
});
+1
-1
tests/refresh.spec.ts
···
52
52
53
53
// Wait for preview to render the timer
54
54
const preview = await h.preview("Timer:");
55
55
-
expect(preview).toMatch(/Timer: \d+s[\s\S]*Refresh/);
55
55
+
expect(preview).toMatch(/Timer: \d+s[\s\S]*/);
56
56
});