-
Notifications
You must be signed in to change notification settings - Fork 2
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/update service deletion #19
Conversation
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.
LGTM
|
||
// Set agent funding requirements | ||
if (_service.chain_data?.instances) { | ||
if (service.chain_data?.instances) { |
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.
You might consider adding it to a new variable since it is used in more than one place.
if (service.chain_data?.instances) { | |
const instances = service.chain_data?.instances; | |
if (instances) { |
setIsStaking(true); | ||
setSpawnScreenState(nextPage); | ||
const service: Service | undefined = await create(true); | ||
if (!service) { |
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 not a big deal, but we could reverse this for better readability.
if (service) { // positive... }
else { // error... }
|
||
await updateServiceState(service.hash).catch(() => | ||
message.error('Failed to update service state'), | ||
); |
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.
usage of await and catch 🙈, can avoid any one, preferably catch.
const newServices = [...prev]; | ||
newServices[index] = service; | ||
return newServices; | ||
}), |
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.
do we want to catch
and log an error?
active:false
until deletion is resolved on backend side