You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(UI-1863): fix info popover not-displayed in triggers and connections tables (#1315)
## Description
# Fix IconButton ref forwarding for popover functionality
## Problem
Popovers were not displaying correctly in triggers and connections
tables due to a React ref forwarding issue. The console showed warnings:
```
Warning: Function components cannot be given refs. Attempts to access this ref will fail.
Did you mean to use React.forwardRef()?
```
This prevented the popover library from properly positioning and
displaying popover content when hovering over info icons.
## Root Cause
The `IconButton` component was not using `React.forwardRef()`, which
meant that when `PopoverTrigger` with `asChild` prop tried to pass a ref
to the IconButton, it failed. This broke the popover positioning
mechanism that relies on getting a reference to the trigger element.
## Solution
Implemented a **combined approach** that takes the best aspects of both
comprehensive and minimal solutions:
### Key Changes
1. **Added proper ref forwarding to IconButton**
- Used `React.forwardRef<HTMLButtonElement | HTMLAnchorElement>` for
correct TypeScript types
- Supports both button and link rendering scenarios
- Maintains backward compatibility
2. **Enhanced Link component with minimal ref support**
- Added `React.forwardRef` to Link component
- Keeps interface simple and focused
3. **Maintained type safety**
- Proper union types prevent future TypeScript errors
- Future-proof design without over-engineering
## Linear Ticket
https://linear.app/autokitteh/issue/UI-1863/fix-info-popover-display-in-triggers-and-connections-tables
## What type of PR is this? (check all applicable)
- [ ] 💡 (feat) - A new feature (non-breaking change which adds
functionality)
- [ ] 🔄 (refactor) - Code Refactoring - A code change that neither fixes
a bug nor adds a feature
- [x] 🐞 (fix) - Bug Fix (non-breaking change which fixes an issue)
- [ ] 🏎 (perf) - Optimization
- [ ] 📄 (docs) - Documentation - Documentation only changes
- [ ] 📄 (test) - Tests - Adding missing tests or correcting existing
tests
- [ ] 🎨 (style) - Styles - Changes that do not affect the meaning of the
code (white-space, formatting, missing semi-colons, etc)
- [ ] ⚙️ (ci) - Continuous Integrations - Changes to our CI
configuration files and scripts (example scopes: Travis, Circle,
BrowserStack, SauceLabs)
- [ ] ☑️ (chore) - Chores - Other changes that don't modify src or test
files
- [ ] ↩️ (revert) - Reverts - Reverts a previous commit(s).
<!--
For a timely review/response, please avoid force-pushing additional
commits if your PR already received reviews or comments.
Before submitting a Pull Request, please ensure you've done the
following:
- 👷♀️ Create small PRs. In most cases this will be possible.
- ✅ Provide tests for your changes.
- 📝 Use descriptive commit messages (as described below).
- 📗 Update any related documentation and include any relevant
screenshots.
Commit Message Structure (all lower-case):
<type>(optional ticket number): <description>
[optional body]
-->
0 commit comments