Skip to content

Commit

Permalink
Update our EUI docs to throw errors on local dev environments
Browse files Browse the repository at this point in the history
- but not on prod/staging, in case of false negatives
  • Loading branch information
cee-chen committed Mar 27, 2024
1 parent 494ae2b commit 2ce8f81
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src-docs/src/views/app_context.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useContext } from 'react';
import React, { useContext, useEffect } from 'react';
import { Helmet } from 'react-helmet';
import { useSelector } from 'react-redux';
import createCache from '@emotion/cache';
Expand All @@ -7,7 +7,10 @@ import { translateUsingPseudoLocale } from '../services';
import { getLocale } from '../store';

import { EuiContext, EuiProvider } from '../../../src/components';
import { euiStylisPrefixer } from '../../../src/services';
import {
setEuiDevProviderWarning,
euiStylisPrefixer,
} from '../../../src/services';
import { EUI_THEMES } from '../../../src/themes';

import favicon16Prod from '../images/favicon/prod/favicon-16x16.png';
Expand Down Expand Up @@ -44,6 +47,13 @@ export const AppContext = ({ children }) => {
};

const isLocalDev = window.location.host.includes('803');
useEffect(() => {
if (isLocalDev) {
setEuiDevProviderWarning('error');
} else {
setEuiDevProviderWarning('warning');
}
}, [isLocalDev]);

return (
<EuiProvider
Expand Down

0 comments on commit 2ce8f81

Please sign in to comment.