Skip to content

fix(connections): duplicate keeps advanced and protocol-specific fields - #92

Merged
GOODBOY008 merged 1 commit into
GOODBOY008:mainfrom
sunxiaobin89:fix/duplicate-connection-lost-advanced-fields
Aug 14, 2026
Merged

fix(connections): duplicate keeps advanced and protocol-specific fields#92
GOODBOY008 merged 1 commit into
GOODBOY008:mainfrom
sunxiaobin89:fix/duplicate-connection-lost-advanced-fields

Conversation

@sunxiaobin89

Copy link
Copy Markdown
Contributor

Fixes #91

Problem

Duplicating a saved connection dropped all advanced/protocol-specific settings (ftpsEnabled, SSH compression/keepAlive/keepAliveInterval/serverAliveCountMax, RDP domain/rdpResolution, VNC vncColorDepth/vncPassword) plus favorite/color/tags/description/sortOrder.

Change

handleDuplicate now copies from the full saved record instead of a hand-listed whitelist — saveConnection is already a full spread of Omit<ConnectionData, 'id' | 'createdAt'>, so the duplicate inherits every field, with only the name overridden.

Intentionally carried over: lastConnected (duplicate inherits recency / quick-connect placement) and profileId (both entries share the profile link). Bonus: original port is preserved (previously node.port || 22 turned Raw/Serial's default 0 into 22).

Tests

  • New src/__tests__/connection-duplicate-fields.test.tsx: (1) deep-equal of the duplicate against the source minus id/createdAt/name (verified red before the fix — 11 vs 28 fields); (2) port 0 preserved for Raw/Serial.
  • pnpm test: 577 pass; tsc --noEmit clean; eslint on changed files: 0 errors.

handleDuplicate hand-listed only auth + proxy fields when saving the
duplicate, silently dropping ftpsEnabled, SSH compression/keepalive
settings, RDP/VNC settings, and favorite/color/tags/description/sortOrder.

Duplicate from the full saved connection record instead (saveConnection
spreads Omit<ConnectionData,'id'|'createdAt'>), overriding only the name.
Notes: lastConnected and profileId are intentionally carried over with the
full copy (the duplicate inherits recency/quick-connect placement and the
profile link). Also preserves the original port (previously
node.port || 22 turned Raw/Serial's 0 into 22).

Test: 577 tests pass, 2 new tests (connection-duplicate-fields.test.tsx)
cover full-field carry-over and port 0 preservation

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes connection duplication so all saved fields and port 0 are preserved.

Changes:

  • Copies the complete connection record except identity fields.
  • Adds regression tests for advanced fields and zero-valued ports.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/components/connection-manager.tsx Duplicates the full saved connection record.
src/__tests__/connection-duplicate-fields.test.tsx Tests complete field and port preservation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@GOODBOY008 GOODBOY008 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@GOODBOY008
GOODBOY008 merged commit 40b54c2 into GOODBOY008:main Aug 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicating a connection drops advanced and protocol-specific settings

3 participants