Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(supernova): refactor localItems, client.js, serviceApi, and processingStatus to use React Query #680

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

TilmanHaupt
Copy link
Contributor

@TilmanHaupt TilmanHaupt commented Dec 12, 2024

Summary

Closes #681

Changes Made

  • Introduced partially Optimistic Updates
  • Deleted duplicates in the state (itemsByState, itemsByHash)
  • Replaced localItem logic with React Query mutations and refetching.
  • Removed obsolete constants associated with localItem and silence states.
  • Deleted client.js, AltertmangerAPI, scheduledSilencesWrapper and apiService, as their responsibilities have been migrated to React Query or other parts of the code.
  • Updated modal handling to ensure they close where appropriate, streamlining user interactions.
  • This refactor simplifies state management, reduces redundancy, and leverages React Query’s capabilities for a cleaner, more maintainable codebase.

Testing Instructions

  1. npm i
  2. npm run TASK

Checklist

  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have made corresponding changes to the documentation (if applicable).
  • My changes generate no new warnings or errors.

@TilmanHaupt TilmanHaupt requested a review from a team as a code owner December 12, 2024 15:40
Copy link

changeset-bot bot commented Dec 12, 2024

🦋 Changeset detected

Latest commit: df3ade6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudoperators/juno-app-supernova Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@TilmanHaupt TilmanHaupt changed the title Til del rq refactor(supernova): introduced reactQuery mutations Dec 12, 2024
Copy link
Contributor

github-actions bot commented Dec 12, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://cloudoperators.github.io/juno/pr-preview/pr-680/
on branch gh-pages at 2024-12-19 11:35 UTC

@TilmanHaupt TilmanHaupt changed the title refactor(supernova): introduced reactQuery mutations refactor(supernova): refactor localItems, client.js, serviceApi, and processingStatus to use React Query Dec 12, 2024
@TilmanHaupt TilmanHaupt self-assigned this Dec 12, 2024
@barsukov barsukov marked this pull request as draft December 12, 2024 22:36
@barsukov barsukov added the draft label Dec 12, 2024
@TilmanHaupt TilmanHaupt marked this pull request as ready for review December 17, 2024 16:45
@ArtieReus ArtieReus removed the draft label Dec 18, 2024
Copy link
Collaborator

@ArtieReus ArtieReus left a comment

Choose a reason for hiding this comment

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

This refactoring looks promising! Thank you! I’ve tested the UI despite the broken UI components, and I’d like to share my initial findings:

  • The alerts list only displays active alerts.
  • When silencing an alert from the alerts list, a success message is shown. However, the alert disappears from the list immediately, making it unclear whether the alert was successfully silenced, as it is no longer displayed.

Copy link
Contributor

@barsukov barsukov left a comment

Choose a reason for hiding this comment

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

Great job, a lot of code deleted more clear way. Few comments from my side 🥇

apps/supernova/src/lib/queries/mutationFunctions.js Outdated Show resolved Hide resolved
apps/supernova/src/hooks/useBoundMutation.js Outdated Show resolved Hide resolved
apps/supernova/src/components/silences/ExpireSilence.jsx Outdated Show resolved Hide resolved
apps/supernova/src/AppContent.jsx Outdated Show resolved Hide resolved
apps/supernova/src/components/silences/SilenceNew.jsx Outdated Show resolved Hide resolved
@TilmanHaupt TilmanHaupt marked this pull request as draft December 18, 2024 16:55
@TilmanHaupt TilmanHaupt marked this pull request as ready for review December 19, 2024 11:33
@TilmanHaupt TilmanHaupt removed the draft label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK](supernova): introduce react query mutations with optimistic updates, remove old mutation related code
3 participants