Skip to content

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

Merged
merged 20 commits into from
Apr 16, 2025

Conversation

jaaydenh
Copy link
Contributor

@jaaydenh jaaydenh commented Apr 14, 2025

resolves coder/preview#57

@jaaydenh jaaydenh self-assigned this Apr 14, 2025
@jaaydenh jaaydenh marked this pull request as ready for review April 14, 2025 20:38
@jaaydenh jaaydenh requested a review from aslilac April 14, 2025 20:38
Base automatically changed from jaaydenh/dynamic-parameter-component to main April 16, 2025 09:00
@jaaydenh jaaydenh force-pushed the jaaydenh/dynamic-params-websocket branch from a39b095 to e04ce2f Compare April 16, 2025 09:17
@jaaydenh jaaydenh requested a review from aslilac April 16, 2025 14:43
@jaaydenh jaaydenh force-pushed the jaaydenh/dynamic-params-websocket branch from 266620a to 440fedc Compare April 16, 2025 16:32
Comment on lines 113 to 125
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;
});
};
Copy link
Member

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 🤷‍♀️

Copy link
Contributor Author

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.

@jaaydenh jaaydenh merged commit 3d787da into main Apr 16, 2025
34 checks passed
@jaaydenh jaaydenh deleted the jaaydenh/dynamic-params-websocket branch April 16, 2025 16:49
@github-actions github-actions bot locked and limited conversation to collaborators Apr 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connect Experimental Workspace Create Page with new coder websocket
2 participants