@autobusal/providers 1.3.9 → 1.4.0
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.
- package/CHANGELOG.md +25 -0
- package/Setup/languages.ts +13 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,31 @@ All notable changes to `@autobusal/providers` are documented here. This project
|
|
|
4
4
|
adheres to [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
5
5
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.4.0] - 2026-07-30
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **Cache-busting on language file requests (`Setup/languages.ts`).** A
|
|
12
|
+
production report showed the admin panel still displaying raw i18n keys
|
|
13
|
+
after obtapi's translation JSON was fixed and confirmed correct
|
|
14
|
+
server-side - even after multiple manual hard-reloads. `Cache-Control:
|
|
15
|
+
no-cache` on obtapi's side only asks caches to revalidate before reuse,
|
|
16
|
+
which was not reliable enough against whatever was actually caching
|
|
17
|
+
(browser and/or an intermediate proxy) in the real deployment. The
|
|
18
|
+
`loadPath` now appends `?v={{VITE_BUILD_ID}}`, a fresh value baked in at
|
|
19
|
+
build time by the consuming app's `vite.config.ts` `define` - every
|
|
20
|
+
rebuild produces a URL nothing in the chain has ever cached, independent
|
|
21
|
+
of whether that cache actually honors Cache-Control. Falls back to a
|
|
22
|
+
fixed `'dev'` string if the consumer hasn't defined `VITE_BUILD_ID` yet
|
|
23
|
+
(no worse than before). **Requires consuming apps to add a
|
|
24
|
+
`VITE_BUILD_ID` define to `vite.config.ts`** (done for magus and
|
|
25
|
+
alvavel alongside this release) for the cache-busting to take effect -
|
|
26
|
+
without it, this version behaves identically to 1.3.9.
|
|
27
|
+
- Companion fix in obtapi: `public/.htaccess` strengthened from
|
|
28
|
+
`Cache-Control: no-cache` to `no-store, no-cache, must-revalidate,
|
|
29
|
+
max-age=0` plus `Pragma`/`Expires`, so language JSON is never stored by
|
|
30
|
+
a compliant cache at all, not just revalidated.
|
|
31
|
+
|
|
7
32
|
## [1.3.9] - 2026-07-30
|
|
8
33
|
|
|
9
34
|
### Fixed
|
package/Setup/languages.ts
CHANGED
|
@@ -6,6 +6,18 @@ export const getLanguage = (defaultLanguage: string): string => (
|
|
|
6
6
|
localStorage.getItem('language') ?? defaultLanguage
|
|
7
7
|
);
|
|
8
8
|
|
|
9
|
+
// Cache-busting query param for the language files. `Cache-Control: no-cache`
|
|
10
|
+
// on the obtapi side only asks caches to revalidate before reuse - in
|
|
11
|
+
// practice that was not enough (some browser/proxy along the way kept
|
|
12
|
+
// serving a stale translation file across manual hard-reloads after a
|
|
13
|
+
// deploy). VITE_BUILD_ID is a fresh value baked in at build time by each
|
|
14
|
+
// consuming app's vite.config.ts (`define`), so every rebuild produces a
|
|
15
|
+
// URL that has never been requested before - nothing anywhere in the chain
|
|
16
|
+
// can have a stale cache entry for it, independent of whether that cache
|
|
17
|
+
// respects Cache-Control at all. Falls back to a fixed string for any
|
|
18
|
+
// consumer that hasn't set VITE_BUILD_ID yet (no worse than before).
|
|
19
|
+
const buildId = import.meta.env.VITE_BUILD_ID ?? 'dev';
|
|
20
|
+
|
|
9
21
|
const languages = (type: string, defaultLanguage: string): void => {
|
|
10
22
|
if (i18next.isInitialized) {
|
|
11
23
|
return;
|
|
@@ -22,7 +34,7 @@ const languages = (type: string, defaultLanguage: string): void => {
|
|
|
22
34
|
fallbackLng: defaultLanguage,
|
|
23
35
|
debug: import.meta.env.DEV,
|
|
24
36
|
backend: {
|
|
25
|
-
loadPath: `${ import.meta.env.VITE_API_OBT }/languages/{{lng}}/{{ns}}.json`
|
|
37
|
+
loadPath: `${ import.meta.env.VITE_API_OBT }/languages/{{lng}}/{{ns}}.json?v=${ buildId }`
|
|
26
38
|
},
|
|
27
39
|
ns: type
|
|
28
40
|
});
|