M: Minor dev fixes
This commit is contained in:
parent
6cfc695bbe
commit
c15edd2d84
|
|
@ -72,7 +72,6 @@ export default [
|
||||||
settings: { react: { version: 'detect' } },
|
settings: { react: { version: 'detect' } },
|
||||||
rules: {
|
rules: {
|
||||||
...basicRules,
|
...basicRules,
|
||||||
'react-refresh/only-export-components': ['off', { allowConstantExport: true }],
|
|
||||||
'simple-import-sort/imports': [
|
'simple-import-sort/imports': [
|
||||||
'warn',
|
'warn',
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export function GlobalProviders({ children }: React.PropsWithChildren) {
|
||||||
<IntlProvider locale='ru' defaultLocale='ru'>
|
<IntlProvider locale='ru' defaultLocale='ru'>
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
|
|
||||||
<ReactQueryDevtools initialIsOpen={false} />
|
{import.meta.env.DEV ? <ReactQueryDevtools initialIsOpen={false} /> : null}
|
||||||
{children}
|
{children}
|
||||||
|
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,9 @@ export function DescribeError({ error }: { error: ErrorData }) {
|
||||||
let sanitizedHtml: string | null = null;
|
let sanitizedHtml: string | null = null;
|
||||||
if (isHtml) {
|
if (isHtml) {
|
||||||
sanitizedHtml = DOMPurify.sanitize(error.response.data as string, {
|
sanitizedHtml = DOMPurify.sanitize(error.response.data as string, {
|
||||||
USE_PROFILES: { html: true }
|
USE_PROFILES: { html: true },
|
||||||
|
ALLOWED_TAGS: ['b', 'i', 'em', 'strong', 'ul', 'li', 'br'],
|
||||||
|
ALLOWED_ATTR: []
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { App } from './app';
|
||||||
|
|
||||||
import './index.css';
|
import './index.css';
|
||||||
|
|
||||||
if (typeof window !== 'undefined' && !!process.env.NODE_ENV && process.env.NODE_ENV === 'development') {
|
if (typeof window !== 'undefined' && import.meta.env.DEV) {
|
||||||
void import('react-scan').then(module =>
|
void import('react-scan').then(module =>
|
||||||
module.scan({
|
module.scan({
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
@ -13,17 +13,19 @@ if (typeof window !== 'undefined' && !!process.env.NODE_ENV && process.env.NODE_
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('error', (event: ErrorEvent) => {
|
if (typeof window !== 'undefined') {
|
||||||
const error = event.error as Error;
|
window.addEventListener('error', (event: ErrorEvent) => {
|
||||||
if (
|
const error = event.error as Error;
|
||||||
error instanceof Error &&
|
if (
|
||||||
typeof error.message === 'string' &&
|
error instanceof Error &&
|
||||||
error.message.includes('Failed to fetch dynamically imported module')
|
typeof error.message === 'string' &&
|
||||||
) {
|
error.message.includes('Failed to fetch dynamically imported module')
|
||||||
console.warn('Detected stale bundle — reloading...');
|
) {
|
||||||
window.location.reload();
|
console.warn('Detected stale bundle — reloading...');
|
||||||
}
|
window.location.reload();
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
createRoot(document.getElementById('root')!).render(
|
createRoot(document.getElementById('root')!).render(
|
||||||
<GlobalProviders>
|
<GlobalProviders>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user