Skip to content

ui fixes#1064

Open
saeedvaziry wants to merge 4 commits into4.xfrom
ui-fixes
Open

ui fixes#1064
saeedvaziry wants to merge 4 commits into4.xfrom
ui-fixes

Conversation

@saeedvaziry
Copy link
Member

  • fix realtime for server and site installation
  • fix console error on server creation form
  • fix combobox and command scroll

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

UI-focused fixes to improve realtime installation status updates for servers/sites, eliminate a console warning on the server creation form, and resolve scrolling behavior issues in command/combobox components.

Changes:

  • Add a useRealtimeRecord hook and use it in the server header to react to server.updated / site.updated socket events, reloading on install completion.
  • Improve install progress reporting for multiple site types and broadcast progress updates for sites/servers.
  • Adjust Command/Combobox wheel handling and mark the public key textarea as read-only to prevent React warnings.

Reviewed changes

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

Show a summary per file
File Description
resources/js/pages/servers/components/header.tsx Subscribe to realtime server/site updates and reload when installation completes; fix site progress rendering.
resources/js/pages/servers/components/create-server.tsx Mark public key textarea as readOnly to prevent editing/warnings.
resources/js/hooks/use-socket-events.ts Introduce useRealtimeRecord for syncing a single record via socket events.
resources/js/components/ui/command.tsx Stop wheel event propagation from Command list to improve nested scroll behavior.
resources/js/components/ui/combobox.tsx Remove redundant wheel handler now handled inside CommandList.
package-lock.json Lockfile metadata change.
app/SiteTypes/Wordpress.php Adjust installation progress milestones.
app/SiteTypes/PHPSite.php Adjust installation progress milestones.
app/SiteTypes/PHPMyAdmin.php Adjust installation progress milestones.
app/SiteTypes/PHPBlank.php Adjust installation progress milestones.
app/SiteTypes/NodeJS.php Adjust installation progress milestones.
app/SiteTypes/AbstractSiteType.php Broadcast site.updated events on progress updates.
app/Actions/Server/InstallServer.php Broadcast server.updated events on progress updates.

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

Comment on lines +71 to +74
SocketEvent::dispatch(new SocketEventDTO(
projectId: $this->site->server->project_id,
type: 'site.updated',
data: new SiteResource($this->site),
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

progress() now dispatches site.updated using SiteResource, which includes type_data. For some site types (e.g. WordPress) type_data contains plaintext credentials (admin password, database password), so this will broadcast sensitive data repeatedly during installs. Consider broadcasting a minimal payload for progress updates (e.g. id/status/status_color/progress) or introduce a dedicated resource that omits secrets, and reserve the full SiteResource for places where the UI actually needs it.

Suggested change
SocketEvent::dispatch(new SocketEventDTO(
projectId: $this->site->server->project_id,
type: 'site.updated',
data: new SiteResource($this->site),
$sanitizedSite = clone $this->site;
$sanitizedSite->setAttribute('type_data', null);
SocketEvent::dispatch(new SocketEventDTO(
projectId: $this->site->server->project_id,
type: 'site.updated',
data: new SiteResource($sanitizedSite),

Copilot uses AI. Check for mistakes.
Comment on lines +110 to +114
SocketEvent::dispatch(new SocketEventDTO(
projectId: $this->server->project_id,
type: 'server.updated',
data: new ServerResource($this->server),
));
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

progress() now dispatches a full ServerResource on every progress tick. ServerResource::toArray() performs a services()->pluck(...) query, so frequent progress updates can add avoidable DB load during installation. Consider emitting a lightweight progress payload (id/status/status_color/progress/progress_step) or adjust ServerResource to avoid querying services when not needed / use already-loaded relations.

Copilot uses AI. Check for mistakes.
Comment on lines +163 to +168
/**
* Keeps a single resource in sync with socket events.
*
* Returns the live resource (initially from Inertia props, updated via socket).
* Pass `null` to skip listening (safe to call unconditionally).
*/
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

The docstring says “Pass null to skip listening”, but the hook still registers a socket listener and simply ignores events when initial is null. Consider rewording to clarify that it skips handling/updates (or add an early-return path that avoids subscribing when initial is null if you truly want to skip listening).

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.

2 participants