bujjibabukatta opened a new pull request, #8918:
URL: https://github.com/apache/devlake/pull/8918
## Summary
Fixes #8914
## What happened
When clicking "New Connection" from the connection list modal, the `plugin`
state was still an empty string `''` when `ConnectionForm` rendered. This
caused `getPluginConfig('')` to return a fallback config with an empty
`name`,
leading to:
TypeError: Cannot read properties of undefined (reading 'name')
## Root Cause
In `connections.tsx`, `handleShowFormDialog` set `type = 'form'` but did
not ensure `plugin` was set. The form modal only checked `pluginConfig` but
not `plugin` itself, so `ConnectionForm` received an empty string as the
`plugin` prop.
## Changes
**`config-ui/src/routes/connection/connections.tsx`**
- Added `plugin &&` guard to the form modal condition to prevent
`ConnectionForm` from rendering with an empty plugin
**`config-ui/src/plugins/components/connection-form/index.tsx`**
- Added `?? {}` fallback on `getPluginConfig` destructuring
- Added `if (!plugin || !name) return null` guard after all hooks
as a defensive measure
## How to Test
1. Take the latest main branch
2. Navigate to the Connections page
3. Click on any data source plugin
4. Click "New Connection" in the list modal
5. The connection creation form should open correctly without errors
--
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]