mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-24 01:48:18 +03:00
Merge pull request #416 from acelaya-forks/feature/prepend-visits
Feature/prepend visits
This commit is contained in:
commit
23ba140ff4
8 changed files with 16 additions and 15 deletions
|
@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* [#413](https://github.com/shlinkio/shlink-web-client/issues/413) Fixed edit short URL form reflecting outdated info after navigating back from other section.
|
* [#413](https://github.com/shlinkio/shlink-web-client/issues/413) Fixed edit short URL form reflecting outdated info after navigating back from other section.
|
||||||
|
* [#412](https://github.com/shlinkio/shlink-web-client/issues/412) Ensured new visits coming from mercure hub are prepended and not appended, to keep proper sorting.
|
||||||
|
|
||||||
|
|
||||||
## [3.1.0] - 2021-03-29
|
## [3.1.0] - 2021-03-29
|
||||||
|
|
12
package-lock.json
generated
12
package-lock.json
generated
|
@ -13118,7 +13118,7 @@
|
||||||
},
|
},
|
||||||
"load-json-file": {
|
"load-json-file": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
|
"resolved": "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz",
|
||||||
"integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
|
"integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -13164,7 +13164,7 @@
|
||||||
},
|
},
|
||||||
"parse-json": {
|
"parse-json": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
|
"resolved": "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz",
|
||||||
"integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
|
"integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -13173,7 +13173,7 @@
|
||||||
},
|
},
|
||||||
"path-type": {
|
"path-type": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz",
|
"resolved": "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz",
|
||||||
"integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=",
|
"integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -13182,13 +13182,13 @@
|
||||||
},
|
},
|
||||||
"pify": {
|
"pify": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
|
"resolved": "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz",
|
||||||
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
|
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"read-pkg": {
|
"read-pkg": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
|
"resolved": "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz",
|
||||||
"integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=",
|
"integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -13199,7 +13199,7 @@
|
||||||
},
|
},
|
||||||
"read-pkg-up": {
|
"read-pkg-up": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz",
|
"resolved": "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz",
|
||||||
"integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=",
|
"integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
|
|
@ -44,7 +44,7 @@ export default buildReducer<VisitsInfo, OrphanVisitsCombinedAction>({
|
||||||
const { visits } = state;
|
const { visits } = state;
|
||||||
const newVisits = createdVisits.map(({ visit }) => visit);
|
const newVisits = createdVisits.map(({ visit }) => visit);
|
||||||
|
|
||||||
return { ...state, visits: [ ...visits, ...newVisits ] };
|
return { ...state, visits: [ ...newVisits, ...visits ] };
|
||||||
},
|
},
|
||||||
}, initialState);
|
}, initialState);
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ export default buildReducer<ShortUrlVisits, ShortUrlVisitsCombinedAction>({
|
||||||
.filter(({ shortUrl }) => shortUrl && shortUrlMatches(shortUrl, shortCode, domain))
|
.filter(({ shortUrl }) => shortUrl && shortUrlMatches(shortUrl, shortCode, domain))
|
||||||
.map(({ visit }) => visit);
|
.map(({ visit }) => visit);
|
||||||
|
|
||||||
return { ...state, visits: [ ...visits, ...newVisits ] };
|
return { ...state, visits: [ ...newVisits, ...visits ] };
|
||||||
},
|
},
|
||||||
}, initialState);
|
}, initialState);
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ export default buildReducer<TagVisits, TagsVisitsCombinedAction>({
|
||||||
.filter(({ shortUrl }) => shortUrl?.tags.includes(tag))
|
.filter(({ shortUrl }) => shortUrl?.tags.includes(tag))
|
||||||
.map(({ visit }) => visit);
|
.map(({ visit }) => visit);
|
||||||
|
|
||||||
return { ...state, visits: [ ...visits, ...newVisits ] };
|
return { ...state, visits: [ ...newVisits, ...visits ] };
|
||||||
},
|
},
|
||||||
}, initialState);
|
}, initialState);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ describe('orphanVisitsReducer', () => {
|
||||||
expect(visits).toEqual(actionVisits);
|
expect(visits).toEqual(actionVisits);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('appends a new visits on CREATE_VISIT', () => {
|
it('prepends new visits on CREATE_VISIT', () => {
|
||||||
const prevState = buildState({ visits: visitsMocks });
|
const prevState = buildState({ visits: visitsMocks });
|
||||||
|
|
||||||
const { visits } = reducer(
|
const { visits } = reducer(
|
||||||
|
@ -72,7 +72,7 @@ describe('orphanVisitsReducer', () => {
|
||||||
{ type: CREATE_VISITS, createdVisits: [{ visit: {} }, { visit: {} }] } as any,
|
{ type: CREATE_VISITS, createdVisits: [{ visit: {} }, { visit: {} }] } as any,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(visits).toEqual([ ...visitsMocks, {}, {}]);
|
expect(visits).toEqual([{}, {}, ...visitsMocks ]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns new progress on GET_ORPHAN_VISITS_PROGRESS_CHANGED', () => {
|
it('returns new progress on GET_ORPHAN_VISITS_PROGRESS_CHANGED', () => {
|
||||||
|
|
|
@ -66,9 +66,9 @@ describe('shortUrlVisitsReducer', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[{ shortCode: 'abc123' }, [ ...visitsMocks, {}]],
|
[{ shortCode: 'abc123' }, [{}, ...visitsMocks ]],
|
||||||
[{ shortCode: 'def456' }, visitsMocks ],
|
[{ shortCode: 'def456' }, visitsMocks ],
|
||||||
])('appends a new visit on CREATE_VISIT', (state, expectedVisits) => {
|
])('prepends new visits on CREATE_VISIT', (state, expectedVisits) => {
|
||||||
const shortUrl = {
|
const shortUrl = {
|
||||||
shortCode: 'abc123',
|
shortCode: 'abc123',
|
||||||
};
|
};
|
||||||
|
|
|
@ -66,9 +66,9 @@ describe('tagVisitsReducer', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[{ tag: 'foo' }, [ ...visitsMocks, {}]],
|
[{ tag: 'foo' }, [{}, ...visitsMocks ]],
|
||||||
[{ tag: 'bar' }, visitsMocks ],
|
[{ tag: 'bar' }, visitsMocks ],
|
||||||
])('appends a new visit on CREATE_VISIT', (state, expectedVisits) => {
|
])('prepends new visits on CREATE_VISIT', (state, expectedVisits) => {
|
||||||
const shortUrl = {
|
const shortUrl = {
|
||||||
tags: [ 'foo', 'baz' ],
|
tags: [ 'foo', 'baz' ],
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue