-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix issue #14 #46
Fix issue #14 #46
Conversation
@@ -20,6 +20,7 @@ export enum Status { | |||
IN_PROGRESS = "IN_PROGRESS", | |||
IN_PROGRESS_RELOAD = "IN_PROGRESS_RELOAD", | |||
SUCCESS = "SUCCESS", | |||
DELETE_SUCCESS = "DELETE_SUCCESS", | |||
ERROR = "ERROR", | |||
DISABLED = "DISABLED", | |||
} No newline at end of file |
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.
Unfortunately, I cannot see the actual code patch you mentioned. However, based on the information provided, it appears that you are modifying an enum called Status
. You have added a new enum value called DELETE_SUCCESS
to the enum.
For a brief code review, here are a few suggestions:
- Make sure to add a newline at the end of the file. This is not a critical issue but helps with readability and avoids any warnings or errors from certain linters or compilers.
- Naming conventions: Enums are typically named in TitleCase, so you might want to consider renaming the enum from
Status
toStatusCode
or something similar to follow common naming conventions. - Consider documenting the purpose and usage of each enum value, including the newly added
DELETE_SUCCESS
. This can provide additional clarity for developers who use this enum.
Without the actual code implementation, it's challenging to identify potential bug risks or further improvements. If you provide the relevant code, I'll be happy to assist you with a more extensive review.
@@ -55,7 +55,7 @@ export const reducer = <T extends object>( | |||
draft.status = Status.IN_PROGRESS; | |||
break; | |||
case EntityActions.DELETE_ENTITY_SUCCESS: | |||
draft.status = Status.SUCCESS; | |||
draft.status = Status.DELETE_SUCCESS; | |||
break; | |||
// case EntityActions.DELETE_ENTITY_ERROR: | |||
// draft.status = Status.ERROR; |
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.
Based on the given code patch, here are a few observations and suggestions for improvement:
-
In line 55,
export const reducer = <T extends object>(
seems incomplete. It should be followed by the function body or other required parameters. -
It is generally good practice to include a default case in switch statements to handle unexpected actions. Consider adding a default case to cover any unhandled actions.
-
In line 58, changing
draft.status
toStatus.DELETE_SUCCESS
after theDELETE_ENTITY_SUCCESS
action seems reasonable if you have definedStatus.DELETE_SUCCESS
as a valid status in your application. -
The commented-out cases for
DELETE_ENTITY_ERROR
could be removed to keep the code clean and concise. If you need to handle errors, consider uncommenting those lines and handling the error status appropriately in the reducer. -
It would be helpful to review the overall flow of the reducer and ensure it handles all the necessary actions and updates the state correctly.
Remember that without seeing the complete code and its surrounding context, it's difficult to provide a thorough review.
No description provided.