Skip to content

Conversation

@alexander-astrand
Copy link
Contributor

@alexander-astrand alexander-astrand commented Jan 16, 2026

Description

https://regennetwork.atlassian.net/browse/APP-866


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • provided a link to the relevant issue or specification
  • provided instructions on how to test
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

How to test

  1. Go to dashboard and swap between personal and org dashboard on different pages. Make sure you stay on same page when swapping dashboards.

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items
.

I have...

  • confirmed all author checklist items have been addressed
  • reviewed code correctness and readability
  • verified React components follow DRY principles
  • reviewed documentation is accurate
  • reviewed tests
  • manually tested (if applicable)

@netlify
Copy link

netlify bot commented Jan 16, 2026

Deploy Preview for terrasos ready!

Name Link
🔨 Latest commit 96a010d
🔍 Latest deploy log https://app.netlify.com/projects/terrasos/deploys/6977508ad6146200086ce76d
😎 Deploy Preview https://deploy-preview-2789--terrasos.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 project configuration.

@gemini-code-assist
Copy link

Summary of Changes

Hello @alexander-astrand, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the dashboard user experience by introducing smarter navigation when switching between personal and organization views. Instead of always redirecting to a default page, the system now attempts to keep the user on the same section, or a logical fallback, ensuring a more seamless transition and reducing the need for users to re-navigate to their desired content.

Highlights

  • Intelligent Dashboard Navigation: Implemented logic to allow users to stay on the same page (or a relevant fallback) when switching between personal and organization dashboards, improving user experience by maintaining context.
  • Refactored Data Fetching for Dashboard Types: Separated data fetching for profile items and paginated batches into distinct calls for personal and organization dashboards, enabling the system to evaluate content availability for both types simultaneously.
  • Dynamic Path Generation: Introduced a new utility function, getSwitchDashboardPath, which intelligently constructs the target URL based on the current path, the target dashboard type, and the availability of relevant data (e.g., credit batches, credit classes) or support for specific sections.
  • Fallback Navigation: The new navigation logic includes fallbacks to the 'portfolio' section if the current page is not supported in the target dashboard type (e.g., 'members' for personal, 'settings' for organization) or if there's no data to display for that section (e.g., no credit batches).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@alexander-astrand alexander-astrand changed the title feat: APP-866 implement logic for staying on same page when switching… feat: APP-866 stay on same page when switching dashboards Jan 16, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements the logic to maintain the current page when switching between personal and organization dashboards. A new function, getSwitchDashboardPath, is introduced to compute the appropriate navigation path, which includes sensible fallbacks for pages not available on the target dashboard. While the changes successfully implement the feature, I have identified a couple of areas for improvement. My review includes a suggestion to enhance the readability of the path-switching logic and a comment on a potential performance concern related to eager data fetching for both dashboard types.

@alexander-astrand alexander-astrand marked this pull request as ready for review January 19, 2026 11:23
@alexander-astrand
Copy link
Contributor Author

@erikalogie @S4mmyb See testing instructions

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 69ab6e24bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Member

@blushi blushi left a comment

Choose a reason for hiding this comment

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

there's a bug when I'm logging in with a web2 account that is a member of an org (eg a viewer since it has no wallet addr)
if I check my org sell orders, then switch to my user dashboard, I'm redirected to /dashboard/sell-orders while there's actually no sell order section for my web2 account (as expected)

I also found another (existing) bug: as a web2 org member, you can't access the org dashboard portfolio while you should be able to see it without being able to perform any tx of course. But I guess we can create a separate task for that

? organizationHasCreditBatches
: personalHasCreditBatches;

const getSwitchDashboardPath = (targetIsOrg: boolean) => {
Copy link
Member

Choose a reason for hiding this comment

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

we could wrap it in useCallback and we could even migrate some portion of the logic to Dashboard.utils.tsx to improve code visibility, Dashboard.tsx is already quite large!

Copy link
Member

Choose a reason for hiding this comment

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

adding some comments would be nice too

Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you open a bug for the second one?

Copy link
Member

Choose a reason for hiding this comment

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

yes APP-870

@erikalogie
Copy link
Collaborator

Got this error on this deploy preview:
Unexpected Application Error!
Failed to fetch
ApolloError
at new t (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:61464)
at https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/3860-e9913c66a28c210d.js:1:84632
at o (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/3860-e9913c66a28c210d.js:1:64468)
at https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/3860-e9913c66a28c210d.js:1:64383
at new Promise ()
at Object.then (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/3860-e9913c66a28c210d.js:1:64350)
at Object.error (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/3860-e9913c66a28c210d.js:1:64478)
at w (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359084)
at S (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359445)
at t.error (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359998)
at https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:9:171859
at Array.forEach ()
at i (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:9:171828)
at Object.error (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/3860-e9913c66a28c210d.js:1:65591)
at w (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359084)
at S (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359445)
at t.error (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359998)
at Object.error (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/6703-ead9ae7bcff01242.js:12:37910)
at w (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359084)
at S (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359445)
at t.error (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359998)

@blushi
Copy link
Member

blushi commented Jan 20, 2026

Got this error on this deploy preview: Unexpected Application Error! Failed to fetch ApolloError at new t (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:61464) at https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/3860-e9913c66a28c210d.js:1:84632 at o (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/3860-e9913c66a28c210d.js:1:64468) at https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/3860-e9913c66a28c210d.js:1:64383 at new Promise () at Object.then (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/3860-e9913c66a28c210d.js:1:64350) at Object.error (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/3860-e9913c66a28c210d.js:1:64478) at w (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359084) at S (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359445) at t.error (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359998) at https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:9:171859 at Array.forEach () at i (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:9:171828) at Object.error (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/3860-e9913c66a28c210d.js:1:65591) at w (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359084) at S (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359445) at t.error (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359998) at Object.error (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/6703-ead9ae7bcff01242.js:12:37910) at w (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359084) at S (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359445) at t.error (https://deploy-preview-2789--regen-marketplace.netlify.app/_next/static/chunks/8747-d6bfff53d38aa7c7.js:1:359998)

staging server crashed, I has to restart it

@erikalogie
Copy link
Collaborator

Ok this looks good to me aside from the things that Marie already pointed out

@erikalogie
Copy link
Collaborator

https://www.loom.com/share/ccc6a8f37775442db031625d88a61dbc Maybe we should discuss this during the engineering call

@S4mmyb
Copy link
Member

S4mmyb commented Jan 20, 2026

Overall looks good and works - we just discussed on the engineering call that if you are within a project (i.e. managing a project) and switch accounts from that view, the redirect should go to projects rather than portfolio if the individual/org doesn't have access to that project.

@erikalogie
Copy link
Collaborator

https://www.loom.com/share/ccc6a8f37775442db031625d88a61dbc Maybe we should discuss this during the engineering call

@alexander-astrand ignore this, Marie and Sam thought it was fine as-is

@alexander-astrand alexander-astrand force-pushed the feat-APP-866-same-page-dashboard-switch branch from b54dc20 to 479099e Compare January 26, 2026 11:25
Comment on lines +216 to +219
isIssuer: boolean;
showCreditClasses: boolean;
isLoadingIsIssuer: boolean;
isLoadingCreditClasses: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

we could extract this into a reusable type so we do not have to repeat for both organizationProfileItems and personalProfileItems

!targetHasCreditClasses &&
!targetCreditClassesLoading) ||
// Don't navigate to sell-orders if switching to personal dashboard without orders
(section === 'sell-orders' && !targetIsOrg && !hasOrders && !ordersLoading);
Copy link
Member

@blushi blushi Jan 27, 2026

Choose a reason for hiding this comment

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

there's a bug when I'm logging in with a web2 account that is a member of an org (eg a viewer since it has no wallet addr)
if I check my org sell orders, then switch to my user dashboard, I'm redirected to /dashboard/sell-orders while there's actually no sell order section for my web2 account (as expected)

I'm still experiencing this bug

This is because hasOrders is about purchased orders (so credits that have be bought), so nothing to do with sell orders (credits that you sold)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants