Skip to content

Commit a89cd82

Browse files
justin808claude
andcommitted
Apply accepted review polish: functional setState, safer probe script, let-bound probe, drop trace
Four style items accepted from the PR #3953 second-round triage: - Starter counter (dummy JSX + docs snippet) uses the functional update form setCount((c) => c + 1). - The console-log probe message is passed to execute_script as a Capybara argument instead of interpolating Ruby into the JS string. - The probe message local is promoted to let(:log_probe_message). - The starter view drops trace: true (raise_on_prerender_error stays). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 92ba634 commit a89cd82

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

docs/oss/building-features/client-side-routing-instant-navigation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const ShellLayout = () => {
8484
<nav>
8585
<Link to="/dashboard">Home</Link>
8686
<Link to="/dashboard/reports">Reports</Link>
87-
<button type="button" onClick={() => setCount(count + 1)}>
87+
<button type="button" onClick={() => setCount((c) => c + 1)}>
8888
Clicks: {count} {/* survives navigation — the shell never unmounts */}
8989
</button>
9090
</nav>

react_on_rails_pro/spec/dummy/app/views/tanstack_starter/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ https://github.com/shakacode/react_on_rails/blob/main/REACT-ON-RAILS-PRO-LICENSE
1818
Turbo-coexistence track. -%>
1919
<div data-turbo="false">
2020
<%= react_component("TanStackStarterApp", props: @starter_props, prerender: true,
21-
raise_on_prerender_error: true, trace: true) %>
21+
raise_on_prerender_error: true) %>
2222
</div>

react_on_rails_pro/spec/dummy/client/app/ror-auto-load-components/TanStackStarterApp.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const ShellLayout = () => {
5757
return (
5858
<div className="container">
5959
<h1 id="tanstack-starter-shell">TanStack Router Starter</h1>
60-
<button id="tanstack-starter-counter" type="button" onClick={() => setCount(count + 1)}>
60+
<button id="tanstack-starter-counter" type="button" onClick={() => setCount((c) => c + 1)}>
6161
Shell counter: {count}
6262
</button>
6363
<nav>

react_on_rails_pro/spec/dummy/spec/system/tanstack_starter_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
# goog:loggingPrefs browser=ALL option set on rails_helper's
101101
# *_with_logging drivers). Without this probe, a broken log channel would
102102
# return [] and the hydration-error assertion would pass vacuously.
103-
log_probe_message = "tanstack-starter-console-log-probe"
103+
let(:log_probe_message) { "tanstack-starter-console-log-probe" }
104104

105105
before do
106106
# Drain console entries left over from earlier examples in the shared
@@ -117,7 +117,7 @@
117117
expect(page).to have_css("section#tanstack-starter-server-data")
118118
expect(page).to have_text("Server data from Rails RSC payload endpoint")
119119

120-
page.execute_script("console.error('#{log_probe_message}')")
120+
page.execute_script("console.error(arguments[0])", log_probe_message)
121121
console_entries = page.driver.browser.logs.get(:browser)
122122
expect(console_entries.map(&:message)).to include(a_string_including(log_probe_message)),
123123
"Browser console log channel is unavailable; cannot assert " \

0 commit comments

Comments
 (0)