Open nanderstabel opened 3 months ago
As introduced here: https://github.com/impierce/identity-wallet/pull/157#discussion_r1526166365
Several reducers currently have the following signature:
(mut state: AppState, action: Action) -> Result<AppState, AppError>
which need to be replaced with:
(state: AppState, action: Action) -> Result<AppState, AppError>
so that the incoming state is immutable.
instead of changing fields in a mutable state, a new state needs to be returned like this:
return Ok(AppState { field: changed_value, ..state });
Always safer/more idiomatic to keep the state as immutable as possible and only explicitly take ownership over specific fields in order to make them mutable. This will also be closer to redux pattern principles.
handle_siopv2_authorization_request
handle_oid4vp_authorization_request
send_credential_request
toggle_dev_mode
create_identity
Description
As introduced here: https://github.com/impierce/identity-wallet/pull/157#discussion_r1526166365
Several reducers currently have the following signature:
which need to be replaced with:
so that the incoming state is immutable.
instead of changing fields in a mutable state, a new state needs to be returned like this:
Motivation
Always safer/more idiomatic to keep the state as immutable as possible and only explicitly take ownership over specific fields in order to make them mutable. This will also be closer to redux pattern principles.
Resources
157
To-do List
handle_siopv2_authorization_request
handle_oid4vp_authorization_request
send_credential_request
toggle_dev_mode
create_identity