mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-11-15 17:21:38 +03:00
M: Minor dev fixes
This commit is contained in:
parent
45a9bc6787
commit
48de17acc7
|
|
@ -72,7 +72,6 @@ export default [
|
|||
settings: { react: { version: 'detect' } },
|
||||
rules: {
|
||||
...basicRules,
|
||||
'react-refresh/only-export-components': ['off', { allowConstantExport: true }],
|
||||
'simple-import-sort/imports': [
|
||||
'warn',
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export function GlobalProviders({ children }: React.PropsWithChildren) {
|
|||
<IntlProvider locale='ru' defaultLocale='ru'>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
|
||||
<ReactQueryDevtools initialIsOpen={false} />
|
||||
{import.meta.env.DEV ? <ReactQueryDevtools initialIsOpen={false} /> : null}
|
||||
{children}
|
||||
|
||||
</QueryClientProvider>
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ export function DescribeError({ error }: { error: ErrorData }) {
|
|||
let sanitizedHtml: string | null = null;
|
||||
if (isHtml) {
|
||||
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 (
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { App } from './app';
|
|||
|
||||
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 =>
|
||||
module.scan({
|
||||
enabled: true
|
||||
|
|
@ -13,17 +13,19 @@ if (typeof window !== 'undefined' && !!process.env.NODE_ENV && process.env.NODE_
|
|||
);
|
||||
}
|
||||
|
||||
window.addEventListener('error', (event: ErrorEvent) => {
|
||||
const error = event.error as Error;
|
||||
if (
|
||||
error instanceof Error &&
|
||||
typeof error.message === 'string' &&
|
||||
error.message.includes('Failed to fetch dynamically imported module')
|
||||
) {
|
||||
console.warn('Detected stale bundle — reloading...');
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
if (typeof window !== 'undefined') {
|
||||
window.addEventListener('error', (event: ErrorEvent) => {
|
||||
const error = event.error as Error;
|
||||
if (
|
||||
error instanceof Error &&
|
||||
typeof error.message === 'string' &&
|
||||
error.message.includes('Failed to fetch dynamically imported module')
|
||||
) {
|
||||
console.warn('Detected stale bundle — reloading...');
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<GlobalProviders>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user