-
Notifications
You must be signed in to change notification settings - Fork 874
feat: setup connection to dynamic parameters websocket #17393
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
Conversation
site/src/modules/workspaces/DynamicParameter/DynamicParameter.tsx
Outdated
Show resolved
Hide resolved
site/src/pages/CreateWorkspacePage/CreateWorkspacePageExperimental.tsx
Outdated
Show resolved
Hide resolved
site/src/pages/CreateWorkspacePage/CreateWorkspacePageExperimental.tsx
Outdated
Show resolved
Hide resolved
site/src/pages/CreateWorkspacePage/CreateWorkspacePageExperimental.tsx
Outdated
Show resolved
Hide resolved
site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx
Outdated
Show resolved
Hide resolved
a39b095
to
e04ce2f
Compare
266620a
to
440fedc
Compare
const sendMessage = (formValues: Record<string, string>) => { | ||
setWSResponseId((prevId) => { | ||
const request: DynamicParametersRequest = { | ||
id: prevId + 1, | ||
inputs: formValues, | ||
}; | ||
if (ws.current && ws.current.readyState === WebSocket.OPEN) { | ||
ws.current.send(JSON.stringify(request)); | ||
return prevId + 1; | ||
} | ||
return prevId; | ||
}); | ||
}; |
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.
one last thought, I noticed that onMessage
is wrapped in a useCallback
but this isn't. was that intentional? could be nice to wrap this one as well since it's also being passed as a prop to a child 🤷♀️
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.
onMessage was wrapped because its used as a dependency for a useEffect. Sure I can wrap sendMessage as well.
resolves coder/preview#57