Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tech/improvements #10052

Merged
merged 7 commits into from
Mar 4, 2020
Merged

Tech/improvements #10052

merged 7 commits into from
Mar 4, 2020

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented Mar 4, 2020

  • ADD safety check for docs-mode without a story (can happen on initial render)
  • FIX ember docs when description is missing for whatever reason

.

  • CHANGE all css template tags to css objects
  • ADD cors headers to netlify

.

  • REMOVE debug props
  • IMPROVE the navigation e2e cypress test

@ndelangen ndelangen added the maintenance User-facing maintenance tasks label Mar 4, 2020
@ndelangen ndelangen self-assigned this Mar 4, 2020
@@ -26,5 +26,10 @@ export const extractProps = componentName => {
export const extractComponentDescription = componentName => {
const json = getJSONDoc();
const componentDoc = json.included.find(doc => doc.attributes.name === componentName);

if (!componentDoc) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've discovered that sometimes the parameter.component isn't there, and then this code throws because componentDoc is undefined

import { visitExample } from '../helper';

describe('Navigation', () => {
beforeEach(() => {
before(() => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should make the test run a little faster

const Title = styled.div`
font-weight: ${props => props.theme.typography.weight.bold};
`;
const Title = styled.div(({ theme }) => ({
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the bundle smaller, and compilation faster

@@ -276,8 +276,10 @@ export class StoryRenderer {
}

renderDocs({ context, storyStore }: { context: RenderContext; storyStore: StoryStore }) {
const { kind, parameters } = context;

const { kind, parameters, id } = context;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When storybook initially renders, the url contains id="*".

This is a non-valid storyId, but it's because the manager doesn't know a valid ID yet.

This code makes it so docs-mode doesn't throw when that happens.

@@ -54,15 +54,15 @@ const Desktop = React.memo<DesktopProps>(
{({ navProps, mainProps, panelProps, previewProps }) => (
<Fragment>
<S.Sidebar {...navProps}>
<Sidebar debug={navProps} />
<Sidebar />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useful for debugging, but bad for performance.

@@ -7,3 +7,7 @@
YARN_FLAGS = "--version"
DOTENV_DISPLAY_WARNING = "none"
STORYBOOK_EXAMPLE_APP ="true"
[[headers]]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to enable CORS on our examples

@ndelangen ndelangen merged commit ab54994 into next Mar 4, 2020
@ndelangen ndelangen deleted the tech/improvements branch March 4, 2020 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant