Skip to content

OBPIH-6734 Scroll down to bottom position of the page when redo import#4865

Merged
awalkowiak merged 1 commit intorelease/0.9.2-hotfix1from
OBPIH-6734
Sep 30, 2024
Merged

OBPIH-6734 Scroll down to bottom position of the page when redo import#4865
awalkowiak merged 1 commit intorelease/0.9.2-hotfix1from
OBPIH-6734

Conversation

@kchelstowski
Copy link
Collaborator

✨ Description of Change

A concise summary of what is being changed. Please provide enough context for reviewers to be able to understand the change and why it is necessary. If the issue/ticket already provides enough information, you can put "See ticket" as the description.

Link to GitHub issue or Jira ticket:

Description:


📷 Screenshots & Recordings (optional)

If this PR contains a UI change, consider adding one or more screenshots here or link to a screen recording to help reviewers visualize the change. Otherwise, you can remove this section.

@kchelstowski kchelstowski self-assigned this Sep 26, 2024
@github-actions github-actions bot added the domain: frontend Changes or discussions relating to the frontend UI label Sep 26, 2024
@drodzewicz
Copy link
Collaborator

I don't think I understand why was the approach with redux store necessary, I might be missing something so could you explain?

To me, looking at the current code, it looks like we could handle everything in OutboundImport component just like handling redirect to the details step when there is no cached data available

  /** Redirect to first step if there is no cached data */
  useEffect(() => {
    if (_.isEmpty(cachedData) && !is(OutboundImportStep.DETAILS)) {
      navigateToStep(OutboundImportStep.DETAILS);
    }
  }, []);

so basically following the logic, if we have cached data available and we are on Details step, then scroll next button into view

  useEffect(() => {
    if (!_.isEmpty(cachedData) && is(OutboundImportStep.DETAILS)) {
      buttonRef.current.scrollIntoView();
    }
  }, [currentStepKey]);

@kchelstowski
Copy link
Collaborator Author

@drodzewicz the problem with that is then I would have to store the useRef in this component, and pass it to the Details component. The result of that would be that whenever we show the confirm page, the reference would become undefined, as the button would not be rendered by DOM, and it would be difficult to manipulate the state of the reference.
As for the Redux, I decided to use a reducer to avoid passing the props two levels down, and to be able to use a custom hook in one single component instead of mixing approach of passing props a few levels down + creating a custom hook that would use those then.

@awalkowiak awalkowiak merged commit 6021752 into release/0.9.2-hotfix1 Sep 30, 2024
@awalkowiak awalkowiak deleted the OBPIH-6734 branch September 30, 2024 14:23
jwalbers pushed a commit to jwalbers/openboxes that referenced this pull request Oct 29, 2024
jwalbers pushed a commit to jwalbers/openboxes that referenced this pull request Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: frontend Changes or discussions relating to the frontend UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants