Skip to content

Conversation

@Luxxy-GF
Copy link
Contributor

@Luxxy-GF Luxxy-GF commented Dec 4, 2025

feat: implement inline editing for instance name and description

  • Add inline editing for instance name and description in the header
  • Implement updateInstance and renameInstance API functions
  • Add dynamic width resizing for input fields
  • Fix race condition during instance rename by waiting for operation completion
  • Suppress "Instance not found" error during rename transition
  • Create missing Textarea component (though switched to Input for description)

Closes #62

…luding new API functions for updating and renaming instances.
@Hye-Dev Hye-Dev requested a review from Copilot December 4, 2025 03:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements inline editing for instance names and descriptions in the instance header. The key changes enable users to edit these fields directly without navigating to a separate page, with proper handling of the rename operation's asynchronous nature.

  • Add inline editing UI with pencil icons that appear on hover for both name and description fields
  • Implement API functions for updating instance descriptions and renaming instances with operation polling
  • Handle race condition during instance rename by suppressing "Instance not found" errors during the transition period

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
deps/ui-web Updated ui-web subproject commit reference
app/(main)/instance/layout.tsx Added inline editing UI for instance name and description with save/cancel controls and rename state management
app/(main)/instance/_lib/instance.ts Implemented updateInstance and renameInstance API functions with operation polling for async rename operations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Hye-Dev Hye-Dev requested review from Hye-Dev and Copilot December 4, 2025 03:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Comments suppressed due to low confidence (2)

app/(main)/instance/_lib/instance.ts:1

  • The dynamic width calculation Math.max(...length, 1) + 4}ch is duplicated. Consider extracting this to a helper function like calculateInputWidth(text: string, minChars = 1, padding = 4) to improve maintainability.
import { Instance } from '../../instances/_lib/instances.d';

app/(main)/instance/_lib/instance.ts:1

  • The dynamic width calculation Math.max(...length, 1) + 4}ch is duplicated. Consider extracting this to a helper function like calculateInputWidth(text: string, minChars = 1, padding = 4) to improve maintainability.
import { Instance } from '../../instances/_lib/instances.d';

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Luxxy-GF
Copy link
Contributor Author

@Hye-Dev

Copy link
Member

@Hye-Dev Hye-Dev left a comment

Choose a reason for hiding this comment

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

Use the events socket for checking if an operation is done rather than continuous polling

@Hye-Dev
Copy link
Member

Hye-Dev commented Dec 28, 2025

@Luxxy-GF

@Hye-Dev Hye-Dev requested review from Hye-Dev and Copilot December 29, 2025 16:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

settled = true;
socket.close();
reject(new Error('Operation timed out'));
}, OPERATION_EVENT_TIMEOUT_MS);
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

The constant OPERATION_EVENT_TIMEOUT_MS is referenced but not defined anywhere in this file. This will cause a ReferenceError at runtime when the WebSocket fallback is triggered.

Copilot uses AI. Check for mistakes.

socket.onmessage = (event) => {
try {
const data = JSON.parse(event.data) as OperationEvent;
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

The type OperationEvent is not defined or imported in this file. This will cause a TypeScript compilation error.

Copilot uses AI. Check for mistakes.
});
setIsEditingName(false);
// Redirect to new URL
router.push(`/instance?name=${encodeURIComponent(newName)}`);
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

After renaming, onRenameEnd() is never called in the success path. This leaves isRenaming permanently true, preventing the error message from displaying if the user navigates back. Call onRenameEnd() after the router.push or in a useEffect cleanup.

Suggested change
router.push(`/instance?name=${encodeURIComponent(newName)}`);
router.push(`/instance?name=${encodeURIComponent(newName)}`);
onRenameEnd();

Copilot uses AI. Check for mistakes.
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.

Instance Name and Description Editing

2 participants