fix: Prevent Novel Screen Empty State Flash (Closes #2034)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { NovelInfo } from '@database/types';
|
||||
import { getString } from '@i18n/translations';
|
||||
import { createNovelStoreActions } from '../store/novelStore.actions';
|
||||
import { createNovelSlice } from '../store/novelStore';
|
||||
|
||||
interface BootstrapServiceSlice {
|
||||
bootstrapNovelAsync: jest.Mock;
|
||||
@@ -88,6 +89,21 @@ describe('novelStore.bootstrap', () => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('starts in a loading state until the initial bootstrap completes', () => {
|
||||
const state = createNovelSlice({
|
||||
pluginId: 'plugin.test',
|
||||
novelPath: '/x',
|
||||
initialNovelSettings: {
|
||||
sort: 'positionAsc',
|
||||
filter: [],
|
||||
showChapterTitles: true,
|
||||
},
|
||||
});
|
||||
|
||||
expect(state.loading).toBe(true);
|
||||
expect(state.fetching).toBe(true);
|
||||
});
|
||||
|
||||
it('maps a missing novel to the not-found error', async () => {
|
||||
const harness = createHarness();
|
||||
harness.bootstrapService.bootstrapNovelAsync.mockResolvedValue({
|
||||
|
||||
@@ -21,8 +21,8 @@ export const createNovelSlice = ({
|
||||
initialLastRead,
|
||||
}: CreateNovelStoreParams) => {
|
||||
return {
|
||||
loading: false,
|
||||
fetching: false,
|
||||
loading: true,
|
||||
fetching: true,
|
||||
error: undefined,
|
||||
pluginId,
|
||||
novelPath,
|
||||
|
||||
Reference in New Issue
Block a user