-
Notifications
You must be signed in to change notification settings - Fork 84
issue-2158/Refactored redux store utility functions #2482
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
…signment, JoinForms and tags
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.
Awesome work! I have reviewed the code, and I have tried the preview build to verify that all CRUDL of relevant features work as expected. I think it does!
I only have one question below.
export function remoteItemCreatedWithData<DataType extends RemoteData>( | ||
list: RemoteList<DataType>, | ||
data: DataType | ||
): RemoteItem<DataType> { | ||
return updateOrCreateItemWithData(list, data); | ||
} | ||
|
||
export function remoteItemUpdated<DataType extends RemoteData>( | ||
list: RemoteList<DataType>, | ||
updatedData: DataType | ||
): RemoteItem<DataType> { | ||
return updateOrCreateItemWithData(list, updatedData); | ||
} | ||
|
||
export function remoteItemLoaded<DataType extends RemoteData>( | ||
list: RemoteList<DataType>, | ||
updatedData: DataType | ||
): RemoteItem<DataType> { | ||
return updateOrCreateItemWithData(list, updatedData); | ||
} |
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.
I'm sure we've discussed this and I just can't remember, but what is the reason for having these functions that are essentially aliases for updateOrCreateItemWithData()
?
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.
It's to be consistent with the naming. For example, for tags. When we are in the tagCreated, tagUpdated, tagLoaded methods, the developer can use remoteItemCreated, remoteItemUpdated, remoteItemLoaded.
If I had to pick one, I think I'd go with remoteItemUpdated. Would you prefer just having that one? @richardolsson
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.
I understand! How about using updateOrCreateItemWithData()
directly?
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.
changed to remoteItemUpdated
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.
The time has come to push the button.
Related to #2158 |
Description
This PR is a start of refactoring Redux store utility functions. It creates utility methods such as create, load, loaded, update, updated and deleted for the remoteData data type. So far, the refactoring applies only to the following features:
Next step is to get this code reviewed and approved, and then I'll continue refactoring for other features as well.
Screenshots
Only code changes.
Changes
Notes to reviewer
Related issues
The issue won't be completely resolved by this PR.