commit 073cd66f98b4b05c36fc09e679ef1e88815e9ddf
parent 06a1219a5aa1a5d7eb93e22ce7cee912d4d826ed
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 19 May 2026 12:02:50 -0400
Fix category change stale invalidation
Diffstat:
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/common/controller/buildIndex.ts b/common/controller/buildIndex.ts
@@ -403,6 +403,21 @@ export async function buildIndex({
groupsFingerprint
);
};
+ // Catches per-channel `group` field edits in channels/*/config.json, which
+ // leave every other diff signal (video mtimes, settings groupsFingerprint)
+ // untouched. Without this the fast-path would short-circuit and the export
+ // UI would keep rendering the old group layout.
+ const manifestChannelGroupsMatch = (
+ channels: ReadonlyArray<{ name: string; groupId?: string }>,
+ ): boolean => {
+ if (channels.length !== channelGroupByName.size) return false;
+ for (const ch of channels) {
+ const expected = channelGroupByName.get(ch.name);
+ if (expected === undefined) return false;
+ if ((ch.groupId ?? settingsDefaultGroupId) !== expected) return false;
+ }
+ return true;
+ };
if (!anyMutations && !schemaBumped) {
const manifestRaw = await readFile(manifestPath, "utf8").catch(() => null);
if (manifestRaw) {
@@ -412,7 +427,8 @@ export async function buildIndex({
parsed.version === MANIFEST_VERSION &&
parsed.totalCount === live.length &&
parsed.pageSize === SUMMARIES_PAGE_SIZE &&
- manifestGroupsMatch(parsed)
+ manifestGroupsMatch(parsed) &&
+ manifestChannelGroupsMatch(parsed.channels)
) {
const firstPage = path.join(summariesDir, pageFileName(0));
const lastPage = path.join(
@@ -453,7 +469,21 @@ export async function buildIndex({
if (subsManifestRaw) {
try {
const sm = JSON.parse(subsManifestRaw) as SubsManifest;
- if (sm.version !== SUBS_MANIFEST_VERSION) subsIntact = false;
+ if (sm.version !== SUBS_MANIFEST_VERSION) {
+ subsIntact = false;
+ } else {
+ // Same staleness concern as the summaries manifest: subs UI
+ // also renders grouped channels, so a per-channel group edit
+ // must invalidate this manifest too.
+ for (const entry of sm.channels) {
+ const expected = channelGroupByName.get(entry.name);
+ if (expected === undefined) continue;
+ if ((entry.groupId ?? settingsDefaultGroupId) !== expected) {
+ subsIntact = false;
+ break;
+ }
+ }
+ }
} catch {
subsIntact = false;
}