+
Tags
{loadingTags ? 'Loading...' : prettify(tagsList.tags.length)}
diff --git a/src/visits/reducers/visitsOverview.ts b/src/visits/reducers/visitsOverview.ts
index e3f78e59..ac51abf8 100644
--- a/src/visits/reducers/visitsOverview.ts
+++ b/src/visits/reducers/visitsOverview.ts
@@ -13,6 +13,7 @@ export const GET_OVERVIEW = 'shlink/visitsOverview/GET_OVERVIEW';
export interface VisitsOverview {
visitsCount: number;
+ orphanVisitsCount?: number;
loading: boolean;
error: boolean;
}
@@ -21,6 +22,7 @@ export type GetVisitsOverviewAction = ShlinkVisitsOverview & Action;
const initialState: VisitsOverview = {
visitsCount: 0,
+ orphanVisitsCount: 0,
loading: false,
error: false,
};
@@ -28,7 +30,7 @@ const initialState: VisitsOverview = {
export default buildReducer({
[GET_OVERVIEW_START]: () => ({ ...initialState, loading: true }),
[GET_OVERVIEW_ERROR]: () => ({ ...initialState, error: true }),
- [GET_OVERVIEW]: (_, { visitsCount }) => ({ ...initialState, visitsCount }),
+ [GET_OVERVIEW]: (_, { visitsCount, orphanVisitsCount }) => ({ ...initialState, visitsCount, orphanVisitsCount }),
[CREATE_VISITS]: ({ visitsCount, ...rest }, { createdVisits }) => ({
...rest,
visitsCount: visitsCount + createdVisits.length,
diff --git a/test/servers/Overview.test.tsx b/test/servers/Overview.test.tsx
index f2ea285f..7827b637 100644
--- a/test/servers/Overview.test.tsx
+++ b/test/servers/Overview.test.tsx
@@ -32,7 +32,7 @@ describe('', () => {
loadVisitsOverview={loadVisitsOverview}
shortUrlsList={Mock.of({ loading, shortUrls })}
tagsList={Mock.of({ loading, tags: [ 'foo', 'bar', 'baz' ] })}
- visitsOverview={Mock.of({ loading, visitsCount: 3456 })}
+ visitsOverview={Mock.of({ loading, visitsCount: 3456, orphanVisitsCount: 28 })}
selectedServer={Mock.of({ id: serverId })}
createNewVisits={jest.fn()}
loadMercureInfo={jest.fn()}
@@ -49,7 +49,7 @@ describe('', () => {
const wrapper = createWrapper(true);
const cards = wrapper.find(CardText);
- expect(cards).toHaveLength(3);
+ expect(cards).toHaveLength(4);
cards.forEach((card) => expect(card.html()).toContain('Loading...'));
});
@@ -57,10 +57,11 @@ describe('', () => {
const wrapper = createWrapper();
const cards = wrapper.find(CardText);
- expect(cards).toHaveLength(3);
+ expect(cards).toHaveLength(4);
expect(cards.at(0).html()).toContain(prettify(3456));
- expect(cards.at(1).html()).toContain(prettify(83710));
- expect(cards.at(2).html()).toContain(prettify(3));
+ expect(cards.at(1).html()).toContain(prettify(28));
+ expect(cards.at(2).html()).toContain(prettify(83710));
+ expect(cards.at(3).html()).toContain(prettify(3));
});
test('first card displays warning for old shlink versions', () => {