MySQL query optimization. Added loading component.
This commit is contained in:
@@ -49,12 +49,13 @@ export const urlFilter = (data, { domain, raw }) => {
|
||||
};
|
||||
|
||||
export const refFilter = (data, { domain, domainOnly, raw }) => {
|
||||
const regex = new RegExp(domain.startsWith('http') ? domain : `http[s]?://${domain}`);
|
||||
|
||||
const isValidRef = ref => {
|
||||
return ref !== '' && !ref.startsWith('/') && !ref.startsWith('#');
|
||||
};
|
||||
|
||||
if (raw) {
|
||||
const regex = new RegExp(`http[s]?://${domain}`);
|
||||
return data.filter(({ x }) => isValidRef(x) && !regex.test(x));
|
||||
}
|
||||
|
||||
@@ -62,7 +63,7 @@ export const refFilter = (data, { domain, domainOnly, raw }) => {
|
||||
try {
|
||||
const { hostname, origin, pathname, searchParams, protocol } = new URL(url);
|
||||
|
||||
if (hostname === domain) {
|
||||
if (hostname === domain || regex.test(url)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user