-
Notifications
You must be signed in to change notification settings - Fork 478
frontend: Remove multiplexer from useKubeObject function #4204
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
base: main
Are you sure you want to change the base?
Conversation
052f436 to
972f869
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sniok The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Can you make it not hard to enable again? |
972f869 to
4190e6b
Compare
| // Breaking rules of hooks here a little but | ||
| // getWebsocketMultiplexerEnabled is a feature toggle | ||
| // and not a variable so this `if` should never change during runtime | ||
| if (getWebsocketMultiplexerEnabled()) { | ||
| useWebSocket<KubeListUpdateEvent<K>>({ | ||
| url: () => | ||
| makeUrl([KubeObjectEndpoint.toUrl(endpoint!)], { | ||
| ...cleanedUpQueryParams, | ||
| watch: 1, | ||
| fieldSelector: `metadata.name=${name}`, | ||
| }), | ||
| enabled: !!endpoint && !!data, | ||
| cluster, | ||
| onMessage(update: KubeListUpdateEvent<K>) { | ||
| if (update.type !== 'ADDED' && update.object) { | ||
| client.setQueryData(queryKey, new kubeObjectClass(update.object)); | ||
| } | ||
| }, | ||
| }); | ||
| } else { | ||
| useWebSockets({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this violate the no-conditional hooks rule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kind of but not really, I explained it in the comment. Think of it as a compile time 'if', it will never change during the runtime
4190e6b to
f0d5d10
Compare
I've noticed that the details view still uses websocket multiplexer, which we disabled a while ago due to issues.
This PR reverts back to normal direct websocket connection,
Also moves multiplexer to a separate file so it's clearer (it was mixed with default websockets and probably that's why we forgot to disable it for the useKubeObject hook)