Skip to content

Commit

Permalink
Merge pull request #18361 from storybookjs/disable-emotion-unsafe-ssr…
Browse files Browse the repository at this point in the history
…-warnings
  • Loading branch information
tmeasday committed May 31, 2022
2 parents 61d6451 + ca86e9d commit 1dedebb
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 27 deletions.
16 changes: 8 additions & 8 deletions lib/components/src/blocks/ArgsTable/ArgsTable.tsx
@@ -1,6 +1,6 @@
import React, { FC } from 'react';
import pickBy from 'lodash/pickBy';
import { styled, ignoreSsrWarning } from '@storybook/theming';
import { styled } from '@storybook/theming';
import { opacify, transparentize, darken, lighten } from 'polished';
import { includeConditionalArg } from '@storybook/csf';
import { once } from '@storybook/client-logger';
Expand Down Expand Up @@ -111,20 +111,20 @@ export const TableWrapper = styled.table<{
marginLeft: inAddonPanel ? 0 : 1,
marginRight: inAddonPanel ? 0 : 1,

[`tr:first-child${ignoreSsrWarning}`]: {
[`td:first-child${ignoreSsrWarning}, th:first-child${ignoreSsrWarning}`]: {
[`tr:first-child`]: {
[`td:first-child, th:first-child`]: {
borderTopLeftRadius: inAddonPanel ? 0 : theme.appBorderRadius,
},
[`td:last-child${ignoreSsrWarning}, th:last-child${ignoreSsrWarning}`]: {
[`td:last-child, th:last-child`]: {
borderTopRightRadius: inAddonPanel ? 0 : theme.appBorderRadius,
},
},

[`tr:last-child${ignoreSsrWarning}`]: {
[`td:first-child${ignoreSsrWarning}, th:first-child${ignoreSsrWarning}`]: {
[`tr:last-child`]: {
[`td:first-child, th:first-child`]: {
borderBottomLeftRadius: inAddonPanel ? 0 : theme.appBorderRadius,
},
[`td:last-child${ignoreSsrWarning}, th:last-child${ignoreSsrWarning}`]: {
[`td:last-child, th:last-child`]: {
borderBottomRightRadius: inAddonPanel ? 0 : theme.appBorderRadius,
},
},
Expand Down Expand Up @@ -172,7 +172,7 @@ export const TableWrapper = styled.table<{
: lighten(0.05, theme.background.content),
}
: {
[`&:not(:first-child${ignoreSsrWarning})`]: {
[`&:not(:first-child)`]: {
borderTopWidth: 1,
borderTopStyle: 'solid',
borderTopColor:
Expand Down
4 changes: 2 additions & 2 deletions lib/components/src/blocks/Source.tsx
@@ -1,5 +1,5 @@
import React, { ComponentProps, FunctionComponent } from 'react';
import { styled, ThemeProvider, convert, themes, ignoreSsrWarning } from '@storybook/theming';
import { styled, ThemeProvider, convert, themes } from '@storybook/theming';
import { EmptyBlock } from './EmptyBlock';

import { SyntaxHighlighter } from '../syntaxhighlighter/lazy-syntaxhighlighter';
Expand Down Expand Up @@ -52,7 +52,7 @@ const SourceSkeletonPlaceholder = styled.div<{}>(({ theme }) => ({
marginTop: 1,
width: '60%',

[`&:first-child${ignoreSsrWarning}`]: {
[`&:first-child`]: {
margin: 0,
},
}));
Expand Down
6 changes: 3 additions & 3 deletions lib/components/src/spaced/Spaced.tsx
@@ -1,5 +1,5 @@
import React, { FunctionComponent } from 'react';
import { styled, ignoreSsrWarning } from '@storybook/theming';
import { styled } from '@storybook/theming';

const toNumber = (input: any) => (typeof input === 'number' ? input : Number(input));

Expand All @@ -19,15 +19,15 @@ const Container = styled.div<ContainerProps>(
marginLeft: col * theme.layoutMargin,
verticalAlign: 'inherit',
},
[`& > *:first-child${ignoreSsrWarning}`]: {
[`& > *:first-child`]: {
marginLeft: 0,
},
}
: {
'& > *': {
marginTop: row * theme.layoutMargin,
},
[`& > *:first-child${ignoreSsrWarning}`]: {
[`& > *:first-child`]: {
marginTop: 0,
},
},
Expand Down
5 changes: 1 addition & 4 deletions lib/components/src/tabs/tabs.tsx
Expand Up @@ -15,9 +15,6 @@ import { Placeholder } from '../placeholder/placeholder';
import { FlexBar } from '../bar/bar';
import { TabButton } from '../bar/button';

const ignoreSsrWarning =
'/* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */';

export interface WrapperProps {
bordered?: boolean;
absolute?: boolean;
Expand Down Expand Up @@ -87,7 +84,7 @@ const Content = styled.div<ContentProps>(
bottom: 0 + (bordered ? 1 : 0),
top: 40 + (bordered ? 1 : 0),
overflow: 'auto',
[`& > *:first-child${ignoreSsrWarning}`]: {
[`& > *:first-child`]: {
position: 'absolute',
left: 0 + (bordered ? 1 : 0),
right: 0 + (bordered ? 1 : 0),
Expand Down
30 changes: 20 additions & 10 deletions lib/ui/src/index.tsx
Expand Up @@ -7,13 +7,21 @@ import ReactDOM from 'react-dom';

import { Location, LocationProvider, useNavigate } from '@storybook/router';
import { Provider as ManagerProvider, Combo } from '@storybook/api';
import { ThemeProvider, ensure as ensureTheme } from '@storybook/theming';
import {
ThemeProvider,
ensure as ensureTheme,
CacheProvider,
createCache,
} from '@storybook/theming';
import { HelmetProvider } from 'react-helmet-async';

import App from './app';

import Provider from './provider';

const emotionCache = createCache({ key: 'sto' });
emotionCache.compat = true;

const { DOCS_MODE } = global;

// @ts-ignore
Expand Down Expand Up @@ -66,15 +74,17 @@ const Main: FC<{ provider: Provider }> = ({ provider }) => {
: !state.storiesFailed && !state.storiesConfigured;

return (
<ThemeProvider key="theme.provider" theme={ensureTheme(state.theme)}>
<App
key="app"
viewMode={state.viewMode}
layout={isLoading ? { ...state.layout, showPanel: false } : state.layout}
panelCount={panelCount}
docsOnly={story && story.parameters && story.parameters.docsOnly}
/>
</ThemeProvider>
<CacheProvider value={emotionCache}>
<ThemeProvider key="theme.provider" theme={ensureTheme(state.theme)}>
<App
key="app"
viewMode={state.viewMode}
layout={isLoading ? { ...state.layout, showPanel: false } : state.layout}
panelCount={panelCount}
docsOnly={story && story.parameters && story.parameters.docsOnly}
/>
</ThemeProvider>
</CacheProvider>
);
}}
</ManagerProvider>
Expand Down

0 comments on commit 1dedebb

Please sign in to comment.