musora-content-services 2.155.9 → 2.155.12
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/.agent/decisions/2026-04-28-tma-275-mcs-sanity-add-a-v2-url-segmen.md +26 -0
- package/.claude/settings.local.json +14 -0
- package/CHANGELOG.md +11 -0
- package/package.json +1 -1
- package/src/services/contentProgress.js +1 -1
- package/src/services/sanity.js +1 -1
- package/.agent/decisions/2026-04-21-tma-239-mcs-sanity-add-a-v2-query-para.md +0 -26
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
date: 2026-04-28
|
|
3
|
+
pr: railroadmedia/musora-content-services#946
|
|
4
|
+
branch: TMA-275-mcs-sanity-add-a-v2-url-segment-to-to-all-sanity-r
|
|
5
|
+
status: open
|
|
6
|
+
tags: [[jira]], [[bug-fix]]
|
|
7
|
+
components: [[sanity]]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Add /v2 URL segment to all Sanity requests to force cache refresh
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
Sanity responses were being served from a stale CDN cache. To force a cache refresh, a new URL segment `/v2` needed to be appended after the dataset name in all Sanity API requests. The Jira ticket provided the target URL format: `https://sanity.musora.com/{projectId}/apicdn/v{version}/{dataset}/v2?perspective=...`
|
|
14
|
+
|
|
15
|
+
## Decision
|
|
16
|
+
Modified the `baseUrl` construction in `src/services/sanity.js` (line 1570) to append `/v2` after the dataset segment. This is the single place where all Sanity API request URLs are built, so this one-line change affects all queries made through MCS.
|
|
17
|
+
|
|
18
|
+
## Alternatives Considered
|
|
19
|
+
- Adding a cache-busting query parameter instead of a path segment — rejected because the Jira description explicitly shows the `/v2` path segment as the desired approach.
|
|
20
|
+
- Updating config to pass the segment dynamically — unnecessary complexity for a single constant value.
|
|
21
|
+
|
|
22
|
+
## Process Notes
|
|
23
|
+
The URL is constructed in a single location in `fetchFromSanity()` inside `src/services/sanity.js`. Both GET and POST requests use the same `baseUrl`, so the fix applies to all request methods automatically.
|
|
24
|
+
|
|
25
|
+
## Consequences
|
|
26
|
+
All Sanity API requests will now include `/v2` in the path, causing the CDN to treat them as new cache keys and serve fresh data.
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.155.12](https://github.com/railroadmedia/musora-content-services/compare/v2.155.11...v2.155.12) (2026-04-29)
|
|
6
|
+
|
|
7
|
+
### [2.155.11](https://github.com/railroadmedia/musora-content-services/compare/v2.155.10...v2.155.11) (2026-04-28)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **TMA-275:** MCS - Sanity - Add a v2 url segment to to all sanity requests to force a cache refresh ([#946](https://github.com/railroadmedia/musora-content-services/issues/946)) ([b5df1dc](https://github.com/railroadmedia/musora-content-services/commit/b5df1dc943cc9d477dcac5879daaf0725fa60f76))
|
|
13
|
+
|
|
14
|
+
### [2.155.10](https://github.com/railroadmedia/musora-content-services/compare/v2.155.9...v2.155.10) (2026-04-28)
|
|
15
|
+
|
|
5
16
|
### [2.155.9](https://github.com/railroadmedia/musora-content-services/compare/v2.155.8...v2.155.9) (2026-04-28)
|
|
6
17
|
|
|
7
18
|
### [2.155.8](https://github.com/railroadmedia/musora-content-services/compare/v2.155.7...v2.155.8) (2026-04-28)
|
package/package.json
CHANGED
|
@@ -604,7 +604,7 @@ async function saveContentProgress(
|
|
|
604
604
|
// (only to siblings/parents via le bubbles)
|
|
605
605
|
|
|
606
606
|
// skip bubbling if progress hasnt changed, or if offline
|
|
607
|
-
if (progress === currentProgress ||
|
|
607
|
+
if (progress === currentProgress || isOffline) {
|
|
608
608
|
if (!skipPush) db.contentProgress.requestPushUnsynced('save-content-progress')
|
|
609
609
|
return response
|
|
610
610
|
}
|
package/src/services/sanity.js
CHANGED
|
@@ -1567,7 +1567,7 @@ export async function fetchSanity(
|
|
|
1567
1567
|
}
|
|
1568
1568
|
const perspective = globalConfig.sanityConfig.perspective ?? 'published'
|
|
1569
1569
|
const api = globalConfig.sanityConfig.useCachedAPI ? 'apicdn' : 'api'
|
|
1570
|
-
const baseUrl = `https://sanity.musora.com/${globalConfig.sanityConfig.projectId}/${api}/v${globalConfig.sanityConfig.version}/${globalConfig.sanityConfig.dataset}?perspective=${perspective}
|
|
1570
|
+
const baseUrl = `https://sanity.musora.com/${globalConfig.sanityConfig.projectId}/${api}/v${globalConfig.sanityConfig.version}/${globalConfig.sanityConfig.dataset}/v2?perspective=${perspective}`
|
|
1571
1571
|
|
|
1572
1572
|
try {
|
|
1573
1573
|
const encodedQuery = encodeURIComponent(query)
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
date: 2026-04-21
|
|
3
|
-
pr: railroadmedia/musora-content-services#933
|
|
4
|
-
branch: TMA-239-mcs-sanity-add-a-v2-query-parameter-to-all-sanity-
|
|
5
|
-
status: open
|
|
6
|
-
tags: [[jira]], [[bug-fix]], [[sanity]], [[cache]]
|
|
7
|
-
components: [[fetchSanity]]
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Add v=2 query parameter to all Sanity requests to force cache refresh
|
|
11
|
-
|
|
12
|
-
## Context
|
|
13
|
-
All Sanity API requests from musora-content-services were being served with cached responses. Adding a `v=2` query parameter forces a cache refresh, ensuring clients receive up-to-date content.
|
|
14
|
-
|
|
15
|
-
## Decision
|
|
16
|
-
Appended `&v=2` to the `baseUrl` string inside `fetchSanity()` in `src/services/sanity.js`. This is the single location where all Sanity request URLs are constructed, so one targeted change covers every request made through the library.
|
|
17
|
-
|
|
18
|
-
## Alternatives Considered
|
|
19
|
-
- Adding the parameter per call-site: There are dozens of call sites and they all funnel through `fetchSanity`, so modifying the base URL there is cleaner and less error-prone.
|
|
20
|
-
- Making it configurable via `sanityConfig`: The ticket does not ask for configurability — it asks for the parameter to be added to all requests unconditionally.
|
|
21
|
-
|
|
22
|
-
## Process Notes
|
|
23
|
-
The `fetchSanity` function at line 1477 of `src/services/sanity.js` is the sole entry point for all Sanity API calls. It builds `baseUrl` on line 1488 and then appends `&query=...` for GET requests or uses it as the POST URL. Appending `&v=2` to `baseUrl` ensures the parameter is present in both cases.
|
|
24
|
-
|
|
25
|
-
## Consequences
|
|
26
|
-
All future Sanity requests from this library will include `v=2`, bypassing any CDN or server-side cache and ensuring fresh content is returned.
|