mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* fix: correct optional chaining in label-issues-in-release workflow - Updated the filter condition to ensure proper handling of optional chaining for issue labels when label doesn't have a description * add reown to ignored origins of errors in rollbar monitoring * export HintProps * add recipe for Code component and adjust select component props * fix screenshots * fix validator schema for multichain explorer * fix mobile lists in safari * screenshot update * deprecate NEXT_PUBLIC_ROLLUP_L1_BASE_URL env * add support of new Tac operation type * remove recaptcha token from query params * add skin for multichain * update multichain config * fix: og meta tags were not rendered on the server * enable NEXT_PUBLIC_VIEWS_ADDRESS_IDENTICON_TYPE var for multichain * disable e2e test job
85 lines
2.8 KiB
TypeScript
85 lines
2.8 KiB
TypeScript
import { Provider as DefaultProvider, useRollbar as useRollbarDefault } from '@rollbar/react';
|
|
import type React from 'react';
|
|
import type { Configuration } from 'rollbar';
|
|
|
|
import config from 'configs/app';
|
|
import { ABSENT_PARAM_ERROR_MESSAGE } from 'lib/errors/throwOnAbsentParamError';
|
|
import { RESOURCE_LOAD_ERROR_MESSAGE } from 'lib/errors/throwOnResourceLoadError';
|
|
|
|
import { isBot, isHeadlessBrowser, isNextJsChunkError, getRequestInfo, getExceptionClass, getExceptionOriginFileName } from './utils';
|
|
|
|
const feature = config.features.rollbar;
|
|
|
|
const FallbackProvider = ({ children }: { children: React.ReactNode }) => children;
|
|
|
|
const useRollbarFallback = (): undefined => {};
|
|
|
|
export const Provider = feature.isEnabled ? DefaultProvider : FallbackProvider;
|
|
export const useRollbar = feature.isEnabled ? useRollbarDefault : useRollbarFallback;
|
|
|
|
export const clientConfig: Configuration | undefined = feature.isEnabled ? {
|
|
accessToken: feature.clientToken,
|
|
environment: feature.environment,
|
|
payload: {
|
|
code_version: feature.codeVersion,
|
|
app_instance: feature.instance,
|
|
},
|
|
checkIgnore(isUncaught, args, item) {
|
|
if (isBot(window.navigator.userAgent)) {
|
|
return true;
|
|
}
|
|
|
|
if (isHeadlessBrowser(window.navigator.userAgent)) {
|
|
return true;
|
|
}
|
|
|
|
if (isNextJsChunkError(getRequestInfo(item)?.url)) {
|
|
return true;
|
|
}
|
|
|
|
const exceptionClass = getExceptionClass(item);
|
|
const IGNORED_EXCEPTION_CLASSES = [
|
|
// these are React errors - "NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node."
|
|
// they could be caused by browser extensions
|
|
// one of the examples - https://github.com/facebook/react/issues/11538
|
|
// we can ignore them for now
|
|
'NotFoundError',
|
|
|
|
'AbortError',
|
|
];
|
|
|
|
if (exceptionClass && IGNORED_EXCEPTION_CLASSES.includes(exceptionClass)) {
|
|
return true;
|
|
}
|
|
|
|
const originFileName = getExceptionOriginFileName(item);
|
|
const IGNORED_ORIGIN_FILE_NAMES_CHUNKS = [
|
|
'/node_modules/@walletconnect',
|
|
'/node_modules/@reown',
|
|
];
|
|
|
|
if (originFileName && IGNORED_ORIGIN_FILE_NAMES_CHUNKS.some((chunk) => originFileName.includes(chunk))) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
},
|
|
hostSafeList: [ config.app.host ].filter(Boolean),
|
|
ignoredMessages: [
|
|
// these are errors that we throw on when make a call to the API
|
|
RESOURCE_LOAD_ERROR_MESSAGE,
|
|
ABSENT_PARAM_ERROR_MESSAGE,
|
|
|
|
// Filter out network-related errors that are usually not actionable
|
|
'Network Error',
|
|
'Failed to fetch',
|
|
|
|
// Filter out CORS errors from third-party extensions
|
|
'cross-origin',
|
|
|
|
// Filter out client-side navigation cancellations
|
|
'cancelled navigation',
|
|
],
|
|
maxItems: 10, // Max items per page load
|
|
} : undefined;
|