178 handle all websocket messages from the backend #228
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.
This pull request includes several changes to both the backend and frontend components of the project, focusing on improving type safety, handling WebSocket messages, and refining form validation. The most important changes are grouped by theme below. Closes #178.
WebSocket Message Handling:
frontend/src/providers/WebsocketProvider.tsx
: Replaced the inline WebSocket message handler with thereceiveMessage
function fromwebsocketMethods.tsx
.frontend/src/routes/report/websocketMethods.tsx
: Added thereceiveMessage
function to handle WebSocket messages and display notifications based on the message status.Type Safety Improvements:
frontend/src/routes/report/InputRow.tsx
: UpdatedInputRowProps
to useUseFormReturnType<ReportFormValues>
for better type safety and added type annotations to various functions. [1] [2] [3] [4] [5]frontend/src/routes/report/page.tsx
: Updated theform
object to useUseFormReturnType<ReportFormValues>
and added type annotations to functions. [1] [2] [3]frontend/src/routes/report/tables.tsx
: UpdatedTableProps
and related functions to useUseFormReturnType<ReportFormValues>
for better type safety. [1] [2] [3]Form Validation:
frontend/src/routes/report/types.ts
: AddedcustomSize
to theReportFormValidationSchema
and introduced a newreportResponseSchema
for validating WebSocket responses. [1] [2]Enum Serialization:
backend/src/websocket/mod.rs
: Added#[serde(tag = "status", content = "data")]
to theClientMessage
enum for improved serialization.