Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/pages/components/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const requireRaw = require.context(
/\.(js|md|tsx)$/,
);

// Run styled-components ref logic
// https://github.com/styled-components/styled-components/pull/2998
requireDemo.keys().map(requireDemo);

// eslint-disable-next-line react/prop-types
export default function Page({ demos, docs }) {
return <MarkdownDocs demos={demos} docs={docs} requireDemo={requireDemo} />;
Expand Down
4 changes: 4 additions & 0 deletions docs/pages/guides/interoperability.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const requireRaw = require.context(
/\.(js|md|tsx)$/,
);

// Run styled-components ref logic
Copy link
Member

Choose a reason for hiding this comment

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

what is "ref logic"?

Copy link
Member Author

Choose a reason for hiding this comment

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

They test that calling useRef crashes, however, we call it inside a React render method, hence, it warns.

Copy link
Member

Choose a reason for hiding this comment

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

So it's not about "ref logic" but rather about where we instantiate the module (they could use any hook. useRef is just the fasted). Doing it during render triggers a false alarm in styled-components.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you are right

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you are right

// https://github.com/styled-components/styled-components/pull/2998
requireDemo.keys().map(requireDemo);

// eslint-disable-next-line react/prop-types
export default function Page({ demos, docs }) {
return <MarkdownDocs demos={demos} docs={docs} requireDemo={requireDemo} />;
Expand Down
4 changes: 4 additions & 0 deletions docs/pages/styles/advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const requireRaw = require.context(
/\.(js|md|tsx)$/,
);

// Run styled-components ref logic
// https://github.com/styled-components/styled-components/pull/2998
requireDemo.keys().map(requireDemo);

// eslint-disable-next-line react/prop-types
export default function Page({ demos, docs }) {
return <MarkdownDocs demos={demos} docs={docs} requireDemo={requireDemo} />;
Expand Down
4 changes: 4 additions & 0 deletions docs/pages/system/basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const requireRaw = require.context(
/\.(js|md|tsx)$/,
);

// Run styled-components ref logic
// https://github.com/styled-components/styled-components/pull/2998
requireDemo.keys().map(requireDemo);

// eslint-disable-next-line react/prop-types
export default function Page({ demos, docs }) {
return <MarkdownDocs demos={demos} docs={docs} requireDemo={requireDemo} />;
Expand Down