railwatch 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3620348235aae6e5733728931b85a9c0edd0ac31367a4fd143eceee1de28cbc0
4
- data.tar.gz: 273a578b3059f4390854d7452df971d8223c9e4f6c8c6a9e7e8d9f46a27ef1f3
3
+ metadata.gz: c905c857b9616e0eb4a38518afa97d787f0ee12eab644c950671278ec28ef0e3
4
+ data.tar.gz: 98e4c9103ac4231d2a676b55ceca51ff36d9c84c8570c97391c0eb4d07675b27
5
5
  SHA512:
6
- metadata.gz: 82640c29a57b4c99d890b40ef75179d635b53308879516ba4973aaed0cfa1179696e0ee14e6660be2eb59c935611eb395e9f508e583c2604fbe8a7e57da0f8ad
7
- data.tar.gz: 53ff388054d12658c7d0cb99c3d0c3dd01be8579ac2227efbb07d65f008a766851761655904b081c8f344aa5db6f3ad9d2cb1e25a349bf30b943e85cb74489bc
6
+ metadata.gz: 1b31a6f1ae9843426a8480c3f6c9ee8551c886083d6643069cfbd35e5cc7275416fa047d06270d80ce8410619bf0b7431f5ebb0cf9204a59be50ce1f3a30fc08
7
+ data.tar.gz: ed4a1f14aef82b6586b8fd86cd86071b5741906de30f89e12f28327d9e9aeaac664fcbbfc6a2ae1d674ec2ee2599fbcd141fb86c30b44db58c84900f7d21b841
data/CHANGELOG.md CHANGED
@@ -6,6 +6,17 @@
6
6
  filled in by the release commit, which is also the only commit that
7
7
  touches lib/railwatch/version.rb and Gemfile.lock. See CONTRIBUTING.md. -->
8
8
 
9
+ ## 1.1.1 (2026-10-24)
10
+
11
+ - The browser client names the first page load after its Inertia
12
+ component again on inertia_rails 3.23+, which renders the page object as
13
+ `<script data-page="app" type="application/json">` instead of a
14
+ `data-page` attribute on `<div id="app">`. The client only read the
15
+ attribute, so every initial load (the only visits that carry LCP, CLS,
16
+ INP and TTFB) arrived with no component: per-page web vitals were empty.
17
+ Apps that copied the client (`app/frontend/lib/railwatch.ts`) need the
18
+ same change in their copy.
19
+
9
20
  ## 1.1.0 (2026-10-22)
10
21
 
11
22
  - A receiver that refuses the connection (nothing listening: a Railwatch
@@ -659,13 +659,19 @@ function startVitals() {
659
659
  )
660
660
  }
661
661
 
662
- // The component the server rendered this page with, off the root element's
663
- // serialized page object. Inertia's own events take over from here.
662
+ // The component the server rendered this page with, off the serialized page
663
+ // object: inertia_rails 3.23+ renders it as <script data-page="app"
664
+ // type="application/json">, older ones as <div id="app" data-page="...">.
665
+ // Inertia's own events take over from here.
664
666
  function pageComponent(): string | undefined {
665
667
  try {
666
- const page = JSON.parse(
667
- document.getElementById("app")?.dataset.page ?? "{}",
668
- ) as { component?: string }
668
+ const script = document.querySelector(
669
+ 'script[data-page="app"][type="application/json"]',
670
+ )
671
+ const raw = script
672
+ ? script.textContent
673
+ : document.getElementById("app")?.dataset.page
674
+ const page = JSON.parse(raw ?? "{}") as { component?: string }
669
675
  return page.component
670
676
  } catch {
671
677
  // Not an Inertia-rendered page, or the payload moved. Report it anyway.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Railwatch
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railwatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cole Robertson