Bug 1585307 - Prevent URLs from being duplicated in Network Panel's request blocking r=Honza

Differential Revision: https://phabricator.services.mozilla.com/D48920

--HG--
extra : moz-landing-system : lando
This commit is contained in:
David Walsh 2019-10-11 13:26:25 +00:00
Родитель 75688d1f71
Коммит 24ff5a9aa6
1 изменённых файлов: 11 добавлений и 6 удалений

Просмотреть файл

@ -72,13 +72,18 @@ function removeBlockedUrl(state, action) {
function updateBlockedUrl(state, action) {
const { oldUrl, newUrl } = action;
let { blockedUrls } = state;
const blockedUrls = state.blockedUrls.map(item => {
if (item.url === oldUrl) {
return { ...item, url: newUrl };
}
return item;
});
if (!blockedUrls.find(item => item.url === newUrl)) {
blockedUrls = blockedUrls.map(item => {
if (item.url === oldUrl) {
return { ...item, url: newUrl };
}
return item;
});
} else {
blockedUrls = blockedUrls.filter(item => item.url != oldUrl);
}
return {
...state,