refactor(frontend): merge Watch class into useResourceWatch composable#3081
Merged
Conversation
Unix4ever
reviewed
Jul 2, 2026
Unix4ever
approved these changes
Jul 2, 2026
Merge WatchFunc and Watch classes together, as there is no longer a requirement for them to be separated Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
Migrate Watch.setup() into useResourceWatch as part of the slow removal of the Watch class Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
Migrate the tests for Watch to the useResourceWatch tests Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
Remove unnecessary setDescending func from WatchItems. The information can be passed in from the watch event. Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
Inline most of the callbacks in the Watch class to ease refactoring. Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
Lift item handlers up from Watch class to useResourceWatch composable Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
Lift the remaining parts of the Watch class (start & stop) to the useResourceWatch composable. Do some code simplification on the composable side. Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
Merge WatchItems into useResourceWatch composable Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
Lift typescript interfaces from watch to useResourceWatch Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
Remove unnecessary usages of the itemID helper as it does not offer any benefit over using item.metadata.id. Keep it for useResourceWatch incase of k8s resources that may span multiple namespaces. Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
When a stream closes due to a connection drop, store the current state of the list in an intermediary value until the new list is fully bootstrapped. Signed-off-by: Edward Sammut Alessi <edward.sammutalessi@siderolabs.com>
Member
Author
|
/m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge the Watch class into the useResourceWatch composable. Comes with a lot of code simplifications, and is the first step in having watch singletons so that a given resource is never watched more than once across multiple components.
Basic design:
useResourceWatchentry-point, determines if its a single item or list watchuseWatchSingleif single, goes here. Doesn't do much other than set/remove the watched item.useWatchMultiif a list, goes here. All list logic encapsulated here (sorting, bootstrapping, total)useWatchStreamboth single/multi will call this final composable, which handles opening and closing the stream, setting request options, loading/error state, forwarding the stream messages, parsing JSON.Closes #1471