Skip to content

Conversation

@Luxxy-GF
Copy link
Contributor

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

feat: implement live resource updates via events

  • Parse resources metadata from operation events
  • Trigger SWR mutations for affected resources and their parent collections
  • Enable real-time UI updates when operations (start, stop, etc.) occur

Closes #63

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 live resource updates via WebSocket events by integrating SWR's mutation capabilities into the event handling system. When operations complete (start, stop, etc.), the affected resources are automatically revalidated to keep the UI synchronized with backend state changes.

  • Adds SWR mutation triggering based on parsed resources metadata from operation events
  • Implements automatic parent collection mutation using a path-based heuristic
  • Enables real-time UI updates without manual refresh when operations occur

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

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 1 out of 1 changed files in this pull request and generated 2 comments.


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

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 1 out of 1 changed files in this pull request and generated no new comments.


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

@Hye-Dev Hye-Dev self-requested a review December 18, 2025 01:44
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.

This is not fully complete.

Ex: If I go to backups on an instance then press "delete backup", the backup does not disappear from the list until I refresh. Likewise for creating backups.

@Luxxy-GF Luxxy-GF requested a review from Hye-Dev December 23, 2025 16:02
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.

Please fix compilation errors @Luxxy-GF

@Hye-Dev Hye-Dev self-requested a review December 29, 2025 17:01
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.

Compilation errors are still present:

./app/(main)/instance/_hooks/backups.ts:55:25
Type error: Type '(current?: StandardResponse<Backup[]>) => { metadata: Backup[]; type: "sync"; status: string; status_code: StatusCode; } | undefined' is not assignable to type 'StandardResponse<Backup[]> | ((currentData: StandardResponse<Backup[]> | undefined, displayedData: StandardResponse<Backup[]> | undefined) => StandardResponse<...>) | undefined'.
  Type '(current?: StandardResponse<Backup[]>) => { metadata: Backup[]; type: "sync"; status: string; status_code: StatusCode; } | undefined' is not assignable to type '(currentData: StandardResponse<Backup[]> | undefined, displayedData: StandardResponse<Backup[]> | undefined) => StandardResponse<Backup[]>'.
    Type '{ metadata: Backup[]; type: "sync"; status: string; status_code: StatusCode; } | undefined' is not assignable to type 'StandardResponse<Backup[]>'.
      Type 'undefined' is not assignable to type 'StandardResponse<Backup[]>'.

  53 |       },
  54 |       {
> 55 |         optimisticData: removeBackup,
     |                         ^
  56 |         rollbackOnError: true,
  57 |         revalidate: true,
  58 |       },
Next.js build worker exited with code: 1 and signal: null
error: script "build-dev" exited with code 1

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.

Mutations via Event Handler

2 participants