Skip to content
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

feat(app & service release process): resume last edited page during release process #1376

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

kunalgaurav-bmw
Copy link
Contributor

@kunalgaurav-bmw kunalgaurav-bmw commented Nov 27, 2024

Description

Resume to the last edited page during App/Service release process.

Changelog entry:

- **App & Service Release Process**:
  - enabled resuming to the last edited page during App/Service release process. [#1376](https://github.com/eclipse-tractusx/portal-frontend/pull/1376)

Why

Currently if I stop the release process and then get back to the app/service I need to click through all the steps I fulfilled already, It should be automatically resume to the last page where user stop.

Issue

#1335

Checklist

Please delete options that are not relevant.

  • I have followed the contributing guidelines
  • I have performed a self-review of my own code
  • I have successfully tested my changes locally

Copy link
Contributor

@evegufy evegufy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evegufy evegufy added this to the Release 25.03 milestone Dec 4, 2024
@manojava-gk
Copy link
Contributor

@kunalgaurav-bmw its not registration process -> it is release process. Pls change the text in both title and description

@manojava-gk
Copy link
Contributor

@kunalgaurav-bmw could you pls confirm whether only mandatory fields are being checked to increment or decrement the step?

@kunalgaurav-bmw kunalgaurav-bmw changed the title feat(app & service release process): resume last edited page during registration feat(app & service release process): resume last edited page during release process Dec 9, 2024
@kunalgaurav-bmw
Copy link
Contributor Author

@kunalgaurav-bmw could you pls confirm whether only mandatory fields are being checked to increment or decrement the step?

Hi @manojava-gk I have done this changes in useEffect in the following way for the all steps and all the mandatory fields I have added in if condition

useEffect(() => {
if (hasDispatched.current) return
if (
fetchAppStatus?.title &&
fetchAppStatus.provider &&
fetchAppStatus.descriptions[0]?.shortDescription &&
fetchAppStatus.descriptions[1]?.shortDescription &&
fetchAppStatus.useCase?.length &&
fetchAppStatus.supportedLanguageCodes?.length &&
fetchAppStatus.documents?.APP_LEADIMAGE?.length &&
appRedirectStatus
) {
dispatch(increment())
hasDispatched.current = true
}
}, [fetchAppStatus, hasDispatched])

@manojava-gk
Copy link
Contributor

@kunalgaurav-bmw Is it possible to determine the step based on response in the first step itself?

Create a helper file and move all the step specific conditions to the respective places,

function determineStep() {
if(firstStep)
 -> increment(1)
if(secondStep)
 -> increment(2)
 }
 
 function firstStep() {}
 function secondStep() {}
 
 like this ...

component will have only one condition in first step to determine the actual step. All the step based condition will be hosted in the main method as shown above

Copy link
Contributor

@oyo oyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unable to follow what's happening here - guess we should discuss this in a call.

return () => {
dispatch(setAppRedirectStatus(true))
}
}, [])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't seen this pattern in our code before. This returns a cleanup function as described in https://react.dev/reference/react/useEffect#parameters - if the dependency array is empty what difference does it make to not simply call the function but return an internal function?

  useEffect(() => {
      dispatch(setAppRedirectStatus(true))
  }, [])

dispatch(setServiceRedirectStatus(true))
}
}, [])

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another cleanup function - see my other comment. can you explain the need for that?

dispatch(increment())
hasDispatched.current = true
}
}, [fetchAppStatus, hasDispatched])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems quite complicated and hard to follow. What issue are you trying to solve here?

hasDispatched.current = true
}
}, [fetchAppStatus, hasDispatched])

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another complicated block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: IN PROGRESS
Development

Successfully merging this pull request may close these issues.

5 participants