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

[Onboarding] - Refactor tabs and routing #5184

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

antonjoel82
Copy link
Contributor

What change does this PR introduce?

  • Keep Get Started Tabs as a single route with search params for changing tabs
  • Make GetStartedTab a dumb component that just accepts a rendering logic from props
  • Separate concerns from tabs

Why was this change needed?

  • Per UX conversation with Nikolay, this is preferred for routing
  • Sets foundation for us to use a React.Context provider within the tabs page if we need to

Other information (Screenshots)

https://www.loom.com/share/67bc4170b0fa439087521d1730a95222

Copy link

netlify bot commented Feb 12, 2024

Deploy Preview for dev-web-novu ready!

Name Link
🔨 Latest commit 336aaa5
🔍 Latest deploy log https://app.netlify.com/sites/dev-web-novu/deploys/65caa88e217d900008273c90
😎 Deploy Preview https://deploy-preview-5184--dev-web-novu.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@antonjoel82 antonjoel82 changed the base branch from next to usecase-onboarding-project February 12, 2024 23:24
Comment on lines +100 to 105
<Route path={ROUTES.GET_STARTED} element={<GetStartedPage />} />
) : (
<Route path={ROUTES.GET_STARTED} element={<GetStarted />} />
)}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This conditional (that requires a re-render) is why search params don't persist across refresh. Once we remove this, they will work as expected

Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to this scope
I wonder if we could/want to create a "loading" indication on our FF's so in such cases we would create a loading state, so we would avoid unnecessary rerenders and screen changes.

@antonjoel82 would love to hear your thoughts on it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@djabarovgeorge What is FF in this context?

Sounds like a good UX improvement! We could do a temporary one, but overall my preference would be to upgrade our React version to use Suspense which will be a huge improvement overall.

Alternatively, one way I've done this in the past to avoid the re-routing issue is to route to a container page (just a page component that uses the hook to determine which content to show). Then, we'd delete that page later and point directly to the new functionality

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry by i meant feature flag by FF.
Still had not the chance to use Suspense wonder how good is it.
Agree that a middleware component could help.

thanks for the feedback 🙃

@antonjoel82 antonjoel82 force-pushed the NV-3243_onboarding-in-app branch from 336aaa5 to b7b0728 Compare February 12, 2024 23:28
@antonjoel82 antonjoel82 marked this pull request as ready for review February 12, 2024 23:28
@antonjoel82
Copy link
Contributor Author

@djabarovgeorge This is the branch / PR I would branch off of!

Copy link
Contributor

@LetItRock LetItRock left a comment

Choose a reason for hiding this comment

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

nice and clean! 🙌


const PAGE_TITLE = 'Get started';

export function GetStartedPage() {
const { currentOrganization } = useAuthContext();
const { currentTab, setTab } = useTabSearchParams();
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 like should be used inside the GetStartedTabs:

  • otherwise, it will rerender this whole component (but it's fine in this case)
  • child controls the parent state (nah)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback! I will merge it as is for now, but we can memoize the tab behaviors so that they don't re-render the whole component tree if it becomes necessary.

@antonjoel82 antonjoel82 force-pushed the usecase-onboarding-project branch from 0ed134c to d9c3bf0 Compare February 13, 2024 20:14
@antonjoel82 antonjoel82 force-pushed the NV-3243_onboarding-in-app branch from b7b0728 to b4d29fd Compare February 13, 2024 20:17
@antonjoel82 antonjoel82 merged commit d07447e into usecase-onboarding-project Feb 13, 2024
4 checks passed
@antonjoel82 antonjoel82 deleted the NV-3243_onboarding-in-app branch February 13, 2024 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants