himanshumaurya09876 commented on code in PR #4260:
URL: https://github.com/apache/ambari/pull/4260#discussion_r4626822163


##########
ambari-web/latest/src/screens/Services/AddServiceWizard/wizardDataStore/context.tsx:
##########
@@ -330,7 +331,8 @@ export const AddServiceProvider: React.FC<{
       hasCurrentHydration
       && clusterName
       && !isEmpty(serviceComponentInfo)
-      && (!state.addServiceSteps?.HOST_STATUS || 
!state.addServiceSteps?.MASTERS)
+      && (!state.addServiceSteps?.HOST_STATUS || 
!state.addServiceSteps?.MASTERS
+        || installedHosts.length === 0)

Review Comment:
   Hi @prabhjyotsingh, thanks for this patch, and for tracking down the issue 
and lining the checkpoint up with Classic. 
   
   I have one concern about the host reload change in context.tsx
   
   installedHosts is local state that isn't saved in the checkpoint (it's reset 
to [] on scope init). So after a restore this condition is always true and 
getHostComponents() runs. That function dispatches new HOST_STATUS and MASTERS 
payloads, and the reducer replaces the whole step. As a result, the restored 
master assignments for the new service and MASTERS.data.advisorInputKey are 
overwritten with the installed-only layout.
   
   Could we always load installedHosts but dispatch HOST_STATUS and MASTERS 
only when they're missing? It would also help to extend the new test so it 
checks that the restored MASTERS is unchanged after the hosts load.
   
   Thanks again!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to