mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-14 05:06:16 -08:00
fix(workspace): report a local phase while reading the cached Xtream catalog (#1345)
* fix(workspace): report a local phase while reading the cached Xtream catalog Since #1311 the sync overlay is shown for the whole import session, but the DB-first read path never emitted an import phase, so switching to an already-imported Xtream playlist showed a bare "Syncing playlist" card with no badge or description. The Electron data source now reports a 'loading-cached' phase (local-library badge, its own label and detail text) before reading categories/content from SQLite, and the PWA data source reports the remote loading phases on API fetches it previously swallowed. Adds the two new i18n keys to en.json and all 18 locales. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(portals): keep the loading-cached phase from marking a real import The store's onPhaseChange callbacks set isImporting unconditionally, and the initialization error path gates import-cache cleanup on that flag — so a cancelled or failed warm SQLite read would have wiped the healthy cached catalog and forced a full provider redownload. The shared publishImportPhase helper now publishes 'loading-cached' as a presentation-only phase; any remote/save phase still marks the import as running. Adds regression specs (verified to fail against the previous behavior) in a dedicated spec file to stay under the test max-lines limit. Addresses Codex P1 review feedback on #1345. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(portals): scope cancelled-import cleanup to types with remote work A session-wide isImporting flag meant that once any content type contacted the provider, cancelling during a later cache-only read cleared the healthy cached catalogs of every not-yet-completed type. Cleanup now consults a per-session set of types that actually performed remote or save work (populated from typed phase callbacks and save-content events), so cache-only types keep their catalogs on cancellation while genuinely partial types are still cleared. Mixed-scenario regression spec added (mutation-verified against the unguarded behavior). Addresses the second Codex P1 on #1345. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
011f322807
commit
8f9e78ff90
30 files changed
+463
-32
No files matched your search
+2
@@ -461,6 +461,8 @@ export class WorkspaceContextPanelComponent {
|
||||
|
||||
private getXtreamImportPhaseLabelKey(phase: string | null): string {
|
||||
switch (phase) {
|
||||
case 'loading-cached':
|
||||
return 'WORKSPACE.SHELL.XTREAM_IMPORT_LOADING_CACHED';
|
||||
case 'preparing-content':
|
||||
return 'WORKSPACE.SHELL.XTREAM_IMPORT_PREPARING';
|
||||
case 'loading-categories':
|
||||
|
||||
+10
@@ -35,6 +35,7 @@ export function buildXtreamImportPhaseTone(
|
||||
case 'loading-movies':
|
||||
case 'loading-series':
|
||||
return 'remote';
|
||||
case 'loading-cached':
|
||||
case 'preparing-content':
|
||||
case 'saving-categories':
|
||||
case 'saving-content':
|
||||
@@ -82,6 +83,8 @@ export function buildXtreamImportPhaseLabel(
|
||||
translate: TranslateFn
|
||||
): string {
|
||||
switch (phase) {
|
||||
case 'loading-cached':
|
||||
return translate('WORKSPACE.SHELL.XTREAM_IMPORT_LOADING_CACHED');
|
||||
case 'preparing-content':
|
||||
return translate('WORKSPACE.SHELL.XTREAM_IMPORT_PREPARING');
|
||||
case 'loading-categories':
|
||||
@@ -104,9 +107,16 @@ export function buildXtreamImportPhaseLabel(
|
||||
}
|
||||
|
||||
export function buildXtreamImportDetailLabel(
|
||||
phase: string | null | undefined,
|
||||
tone: XtreamImportPhaseTone,
|
||||
translate: TranslateFn
|
||||
): string {
|
||||
// Reading the already-imported catalog from SQLite is a local phase, but
|
||||
// the generic local detail ("prepares faster switches next time") would
|
||||
// misdescribe it — the cache is what is being read, not built.
|
||||
if (phase === 'loading-cached') {
|
||||
return translate('WORKSPACE.SHELL.XTREAM_IMPORT_DETAIL_CACHED');
|
||||
}
|
||||
if (tone === 'remote') {
|
||||
return translate('WORKSPACE.SHELL.XTREAM_IMPORT_DETAIL_REMOTE');
|
||||
}
|
||||
|
||||
+1
@@ -184,6 +184,7 @@ export class WorkspaceShellXtreamImportService {
|
||||
}
|
||||
|
||||
return buildXtreamImportDetailLabel(
|
||||
this.xtreamStore.currentImportPhase(),
|
||||
this.xtreamImportPhaseTone(),
|
||||
this.translateText
|
||||
);
|
||||
|
||||
+19
@@ -458,6 +458,25 @@ describe('WorkspaceShellFacade', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('describes a local-library read while cached content is loading', () => {
|
||||
const xtreamStore = TestBed.inject(
|
||||
XtreamStore
|
||||
) as unknown as MockXtreamStore;
|
||||
const xtreamImport = TestBed.inject(WorkspaceShellXtreamImportService);
|
||||
|
||||
xtreamStore.currentImportPhase.set('loading-cached');
|
||||
|
||||
expect(xtreamImport.xtreamImportPhaseLabel()).toBe(
|
||||
'WORKSPACE.SHELL.XTREAM_IMPORT_LOADING_CACHED'
|
||||
);
|
||||
expect(xtreamImport.xtreamImportSourceLabel()).toBe(
|
||||
'WORKSPACE.SHELL.XTREAM_IMPORT_LOCAL_BADGE'
|
||||
);
|
||||
expect(xtreamImport.xtreamImportDetailLabel()).toBe(
|
||||
'WORKSPACE.SHELL.XTREAM_IMPORT_DETAIL_CACHED'
|
||||
);
|
||||
});
|
||||
|
||||
it('shows the Xtream overlay during refresh preparation for the active playlist', () => {
|
||||
refreshPreparationSignal.set({
|
||||
playlistId: 'pl-1',
|
||||
|
||||
Reference in new issue
Block a user