Skip to content
Merged
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
8 changes: 1 addition & 7 deletions src/utils/handle-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,7 @@ function injectStyle({
const { insertAt } = ref

if (document.getElementById(id)) {
// this should never happen because of `injected[type]`
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line no-console
console.warn(
`[react-tooltip] Element with id '${id}' already exists. Call \`removeStyle()\` first`,
)
}
// this could happen in cases the tooltip is imported by multiple js modules
Copy link
Member Author

Choose a reason for hiding this comment

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

Is this even worth investigating further?

There seems to be no downside to just skipping injecting styles if they're already present.

Copy link
Member

Choose a reason for hiding this comment

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

I do agree, the issue is inject the styles multiple times, but there's no issue if we only ignore it if it's already injected into the website

return
}

Expand Down