korbit-ai[bot] commented on code in PR #33501:
URL: https://github.com/apache/superset/pull/33501#discussion_r2093828614
##########
superset-frontend/src/components/AsyncAceEditor/Tooltip.tsx:
##########
@@ -16,15 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { renderToStaticMarkup } from 'react-dom/server';
+
+import Handlebars from 'handlebars';
Review Comment:
### Unused Handlebars Import <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
Handlebars is imported but never used in the code, contradicting the
developer's intent of using handlebars for template generation.
###### Why this matters
This causes unnecessary bundle size increase and fails to implement the
improved template generation mentioned in the developer's intent.
###### Suggested change ∙ *Feature Preview*
Either remove the unused import or implement Handlebars templating by
modifying getTooltipHTML to use a compiled template:
```typescript
const tooltipTemplate = Handlebars.compile(`
<div class="tooltip-detail">
<div class="tooltip-detail-head">
<div class="tooltip-detail-title">
{{#if icon}}<span
class="tooltip-icon">{{{icon}}}</span>{{/if}}{{{title}}}
</div>
{{#if meta}}<span class="tooltip-detail-meta"><span
class="ant-tag">{{{meta}}}</span></span>{{/if}}
</div>
{{#if body}}<div class="tooltip-detail-body">{{{body}}}</div>{{/if}}
{{#if footer}}<div
class="tooltip-detail-footer">{{{footer}}}</div>{{/if}}
</div>
`);
export function getTooltipHTML(props: Props): string {
const html = tooltipTemplate(props);
return DOMPurify.sanitize(html);
}
`
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/dd94ecbb-3446-42e9-b190-4109ceb5d8f3/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/dd94ecbb-3446-42e9-b190-4109ceb5d8f3?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/dd94ecbb-3446-42e9-b190-4109ceb5d8f3?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/dd94ecbb-3446-42e9-b190-4109ceb5d8f3?what_not_in_standard=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/dd94ecbb-3446-42e9-b190-4109ceb5d8f3)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:fcbf572b-43df-4290-8e97-07e556313efc -->
[](fcbf572b-43df-4290-8e97-07e556313efc)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]