@autobusal/providers 1.44.3 → 1.44.4

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.
Files changed (2) hide show
  1. package/Setup/Preload.tsx +30 -4
  2. package/package.json +1 -1
package/Setup/Preload.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useEffect } from 'react';
2
- import { JsonLd, setServerToday } from '@autobusal/common';
2
+ import { JsonLd, hasMetaMounted, setServerToday } from '@autobusal/common';
3
3
  import { SettingsData } from '../types/settings';
4
4
  import { useSystemTheme } from '@autobusal/hooks';
5
5
 
@@ -76,11 +76,37 @@ const Preload = ({ data, children }: Props): JSX.Element => {
76
76
  // sold them quite happily.
77
77
  setServerToday(data.today);
78
78
 
79
- // the app-shell title, for the moment before a page's own <Meta> mounts
79
+ /*
80
+ * The app-shell title, for the moment before a page's own <Meta> mounts -
81
+ * AND MARKED, so that page can take it away again.
82
+ *
83
+ * Edited: Claude - Date: 2026-09-16
84
+ *
85
+ * Assigning document.title when <head> holds no <title> does not just set a
86
+ * string: the browser CREATES a <title> element for it. On a route whose
87
+ * chunk is still loading there is nothing else in there - main.tsx has
88
+ * already stripped index.html's build-time tag - so this fallback made one,
89
+ * and when the page's own <Meta> arrived React hoisted a second beside it.
90
+ * Both were then captured into the prerendered snapshot, which is why Bing's
91
+ * site scan reported "More than one title tag" on 112 pages. A browser reads
92
+ * the first, which is the right one, so nothing looked wrong; a crawler
93
+ * reading the HTML sees two, and the stray one says only the brand name.
94
+ *
95
+ * Meta removes any element carrying this marker as soon as it owns the head
96
+ * (see useSoleMetaOwnership in @autobusal/common), so the fallback lasts
97
+ * exactly as long as it is the only title there is.
98
+ */
80
99
  useEffect(() => {
81
- if (!document.head.querySelector('title')) {
82
- document.title = data.preferences.company;
100
+ // Nothing to stand in for: the page owns the title, or already put one
101
+ // up. hasMetaMounted is the half of this that a marker cannot cover -
102
+ // see the note on it in @autobusal/common's Meta.
103
+ if (hasMetaMounted() || document.head.querySelector('title')) {
104
+ return;
83
105
  }
106
+
107
+ document.title = data.preferences.company;
108
+
109
+ document.head.querySelector('title')?.setAttribute('data-shell-title', '');
84
110
  }, [ data.preferences.company ]);
85
111
 
86
112
  // we arrange the font family names before inserting them
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/providers",
3
- "version": "1.44.3",
3
+ "version": "1.44.4",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts",