Skip to content

generic message display controlled by reducer logic#182

Merged
richardiphillips merged 1 commit intomainfrom
reqmess
Apr 29, 2025
Merged

generic message display controlled by reducer logic#182
richardiphillips merged 1 commit intomainfrom
reqmess

Conversation

@richardiphillips
Copy link
Copy Markdown
Contributor

No description provided.

@richardiphillips richardiphillips requested a review from a team April 29, 2025 08:50
Copy link
Copy Markdown
Collaborator

@lewisrenfrew lewisrenfrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool - I had debated extending the reducer out to support managing state that isn't directly part of the req

I guess this just means that when formState gets submitted via a request (on save click) it might include some extra data like formState.message that the server will just ignore when it binds the request body to a RequisitionHeaderResource

@richardiphillips
Copy link
Copy Markdown
Contributor Author

cool - I had debated extending the reducer out to support managing state that isn't directly part of the req

I guess this just means that when formState gets submitted via a request (on save click) it might include some extra data like formState.message that the server will just ignore when it binds the request body to a RequisitionHeaderResource

Yeah. I ummed and aahhed about it. Feels the lesser of two evils to keep all the logic inside the reducer but like everything else it can always be changed

@richardiphillips richardiphillips merged commit 1fc0d84 into main Apr 29, 2025
2 checks passed
@richardiphillips richardiphillips deleted the reqmess branch April 29, 2025 09:17
@lewisrenfrew
Copy link
Copy Markdown
Collaborator

cool - I had debated extending the reducer out to support managing state that isn't directly part of the req
I guess this just means that when formState gets submitted via a request (on save click) it might include some extra data like formState.message that the server will just ignore when it binds the request body to a RequisitionHeaderResource

Yeah. I ummed and aahhed about it. Feels the lesser of two evils to keep all the logic inside the reducer but like everything else it can always be changed

One very simple similar idea i had was extend the formState object

{
req: {... all the req stuff},
messages: [] // some messages, could even include validation results etc,
anythingElse: any other state we might want to manage that isnt directly part of the req data structure
}

and then only submit formState.req in requests on save clicks etc

@richardiphillips
Copy link
Copy Markdown
Contributor Author

cool - I had debated extending the reducer out to support managing state that isn't directly part of the req
I guess this just means that when formState gets submitted via a request (on save click) it might include some extra data like formState.message that the server will just ignore when it binds the request body to a RequisitionHeaderResource

Yeah. I ummed and aahhed about it. Feels the lesser of two evils to keep all the logic inside the reducer but like everything else it can always be changed

One very simple similar idea i had was extend the formState object

{ req: {... all the req stuff}, messages: [] // some messages, could even include validation results etc, anythingElse: any other state we might want to manage that isnt directly part of the req data structure }

and then only submit formState.req in requests on save clicks etc

100%. that's actually how i had it sketched out in my notepad but sort of forgot while i was messing about. i'll refactor next time i'm in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants