-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
Remove warning about styles already being injected #1203
Conversation
WalkthroughThe update addresses a bug where multiple JavaScript modules might attempt to import the tooltip leading to multiple elements with the same ID. This change ensures appropriate handling of such scenarios, preventing conflicts by recognizing the potential existence of elements with duplicate IDs. Changes
Assessment against linked issues
Poem
Tip Early access features: enabledWe are currently testing the following features in early access:
Note:
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
`[react-tooltip] Element with id '${id}' already exists. Call \`removeStyle()\` first`, | ||
) | ||
} | ||
// this could happen in cases the tooltip is imported by multiple js modules |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Beta version released with the last commit 🚀
or
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/utils/handle-style.ts (1 hunks)
Additional comments not posted (1)
src/utils/handle-style.ts (1)
55-56
: LGTM! Consider logging when the function returns early.The code changes are approved. This update prevents duplicate style elements from being injected, addressing the issue discussed in the PR objectives.
Consider adding a log or warning when the function returns early due to an existing element. This can help in debugging potential issues.
// this could happen in cases the tooltip is imported by multiple js modules + console.warn(`[react-tooltip] Style element with id '${id}' already exists. Skipping injection.`); return
`[react-tooltip] Element with id '${id}' already exists. Call \`removeStyle()\` first`, | ||
) | ||
} | ||
// this could happen in cases the tooltip is imported by multiple js modules |
There was a problem hiding this comment.
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
## [1.0.2](https://github.com/equinor/webviz-subsurface-components/compare/wsc-common@1.0.1...wsc-common@1.0.2) (2024-10-08) ### Bug Fixes * bump react-tooltip from 5.27.0 to 5.28.0 in /typescript ([#2300](#2300)) ([e355c99](e355c99)), closes [#1209](#1209) [ReactTooltip/react-tooltip#1213](ReactTooltip/react-tooltip#1213) [ReactTooltip/react-tooltip#1211](ReactTooltip/react-tooltip#1211) [ReactTooltip/react-tooltip#1213](ReactTooltip/react-tooltip#1213) [ReactTooltip/react-tooltip#1211](ReactTooltip/react-tooltip#1211) [ReactTooltip/react-tooltip#1203](ReactTooltip/react-tooltip#1203) [ReactTooltip/react-tooltip#1205](ReactTooltip/react-tooltip#1205) [#1209](#1209) [#1213](#1213)
## [1.5.6](https://github.com/equinor/webviz-subsurface-components/compare/well-completions-plot@1.5.5...well-completions-plot@1.5.6) (2024-10-08) ### Bug Fixes * bump react-tooltip from 5.27.0 to 5.28.0 in /typescript ([#2300](#2300)) ([e355c99](e355c99)), closes [#1209](#1209) [ReactTooltip/react-tooltip#1213](ReactTooltip/react-tooltip#1213) [ReactTooltip/react-tooltip#1211](ReactTooltip/react-tooltip#1211) [ReactTooltip/react-tooltip#1213](ReactTooltip/react-tooltip#1213) [ReactTooltip/react-tooltip#1211](ReactTooltip/react-tooltip#1211) [ReactTooltip/react-tooltip#1203](ReactTooltip/react-tooltip#1203) [ReactTooltip/react-tooltip#1205](ReactTooltip/react-tooltip#1205) [#1209](#1209) [#1213](#1213)
## [1.0.3](https://github.com/equinor/webviz-subsurface-components/compare/subsurface-viewer@1.0.2...subsurface-viewer@1.0.3) (2024-10-08) ### Bug Fixes * bump react-tooltip from 5.27.0 to 5.28.0 in /typescript ([#2300](#2300)) ([e355c99](e355c99)), closes [#1209](#1209) [ReactTooltip/react-tooltip#1213](ReactTooltip/react-tooltip#1213) [ReactTooltip/react-tooltip#1211](ReactTooltip/react-tooltip#1211) [ReactTooltip/react-tooltip#1213](ReactTooltip/react-tooltip#1213) [ReactTooltip/react-tooltip#1211](ReactTooltip/react-tooltip#1211) [ReactTooltip/react-tooltip#1203](ReactTooltip/react-tooltip#1203) [ReactTooltip/react-tooltip#1205](ReactTooltip/react-tooltip#1205) [#1209](#1209) [#1213](#1213)
## [1.3.11](https://github.com/equinor/webviz-subsurface-components/compare/group-tree-plot@1.3.10...group-tree-plot@1.3.11) (2024-10-08) ### Bug Fixes * bump react-tooltip from 5.27.0 to 5.28.0 in /typescript ([#2300](#2300)) ([e355c99](e355c99)), closes [#1209](#1209) [ReactTooltip/react-tooltip#1213](ReactTooltip/react-tooltip#1213) [ReactTooltip/react-tooltip#1211](ReactTooltip/react-tooltip#1211) [ReactTooltip/react-tooltip#1213](ReactTooltip/react-tooltip#1213) [ReactTooltip/react-tooltip#1211](ReactTooltip/react-tooltip#1211) [ReactTooltip/react-tooltip#1203](ReactTooltip/react-tooltip#1203) [ReactTooltip/react-tooltip#1205](ReactTooltip/react-tooltip#1205) [#1209](#1209) [#1213](#1213)
## [2.1.1](https://github.com/equinor/webviz-subsurface-components/compare/well-log-viewer@2.1.0...well-log-viewer@2.1.1) (2024-10-08) ### Bug Fixes * bump react-tooltip from 5.27.0 to 5.28.0 in /typescript ([#2300](#2300)) ([e355c99](e355c99)), closes [#1209](#1209) [ReactTooltip/react-tooltip#1213](ReactTooltip/react-tooltip#1213) [ReactTooltip/react-tooltip#1211](ReactTooltip/react-tooltip#1211) [ReactTooltip/react-tooltip#1213](ReactTooltip/react-tooltip#1213) [ReactTooltip/react-tooltip#1211](ReactTooltip/react-tooltip#1211) [ReactTooltip/react-tooltip#1203](ReactTooltip/react-tooltip#1203) [ReactTooltip/react-tooltip#1205](ReactTooltip/react-tooltip#1205) [#1209](#1209) [#1213](#1213)
Closes #1185.
Summary by CodeRabbit