-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Auto-select the Expensify Card tab when first creating a workspace #4280
Comments
Triggered auto assignment to @sonialiap ( |
Proposal
function isWorkspaceActive(menuItemName) {
const name = navigationRef.current.getCurrentRoute().name;
return name === menuItemName;
}
WORKSPACE: {
CARD: 'WorkspaceCard',
PEOPLE: 'WorkspacePeople',
},
Maybe naming can be better |
@aman-atg That seems like a hack. Because |
@rushatgabhane IMO selecting sidebar items after parsing and comparing the routes is just an overkill for a simple task. |
I mean, with your proposal we'll have to create a new constant and function every time we want to check if a route is active. Anyway, check this out, App/src/libs/Navigation/Navigation.js Line 133 in b08f80f
|
And yeah I know that. What are ya trying to say here? |
While I feel this issue is an issue with react-navigation at the first glance. ** Proposal ** We can modify the isActive function that'll look something like this
|
@mananjadhav We maintain
|
That’s the first thing that I checked and it works too. I thought we would be using isActive later for internal screen navigation too. It it is going to be route based then Onyx works. |
Approach with Onyx: Navigation.js
actions/App.js
While I tested and it worked fine. I am just concerned about one thing. Onyx uses a persistence layer with localStorage on the web. This is generally shared by the domain/application. So any updates on one open tab shouldn't affect the other. |
Triggered auto assignment to @iwiznia ( |
I agree with this, given that when we create the workspace, we do:
And then in the workspace card route, we do:
So, that should return true... what I am not sure about is why this is happening... like why after changing the to the correct route/page the |
That's right and I did check that when it gets redirected first, the I checked until the I gave some workaround solutions, but I feel this issue might require a little more digging. |
It might be happening because we're passing an empty object here
|
So, still the solution will be same, i.e. , passing a One example is here,
|
@aman-atg passing a param sounds like a hack, this seems like something relating to our navigation is not totally correct. After you do So as @mananjadhav said, we need a bit more digging to see what exactly is going on. |
This seems an issue with React navigation. The path is not set on the first navigation. |
At the first attempt, I feel this line is what must be causing. |
Can you expand on that @mananjadhav? |
I am not 100% sure of it. I only traced visually without executing. In the navigate action for this line, it only returns the name and the param, not the path. In the other case, it returns the complete payload. Hence when I compared the payload we dispatch it is exactly the same. Hence I didn't comment my findings earlier in the thread. |
@iwiznia @parasharrajat While I couldn't find the root cause yet, I did find a way to get the correct path which is not a hack. Based on the discussion in this thread #react-navigation/react-navigation#9312
The NavigationRoot.parseAndStoreRoute
and Navigation.isActive
We can safely use |
I would say that missing path is not a issue as this is optional property. So we can't blame React navigation for that. But |
I agree. |
@iwiznia Any feedback on the last approach ? |
So does that solve the problem? Seems like no, since you say it's generating different results?
|
Using |
Oh I see... I am not sure I 100% understand the fix, but seems you do and that it works, so I'll check it out and test it when you submit it. |
Sure. It's after a lot of digging this one works properly rather than going through the |
While @kevinksullivan posts a job and gives a shoutout, I've raised the PR to you @iwiznia. I've also attached relevant screencasts to show the outcome. |
Hired! |
@mananjadhav please do not add |
Noted. |
@iwiznia Eep! 4 days overdue now. Issues have feelings too... |
PR has been merged Melvin, leave me alone. |
Paid @mananjadhav . Thanks! |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
freePlan
betaExpected Result:
The
Expensify Card
tab of the Workspace should be Auto-selected when a user has just created one for the first time.Actual Result:
No tab is selected when a user first sees the Workspace, and they arrive at the menu.
Platform:
Where is this issue occurring?
Notes/Photos/Videos:
Notice no tab is selected when first creating the workspace.
Expensify/Expensify Issue URL: https://github.com/Expensify/Expensify/issues/171670#
View all open jobs on Upwork
The text was updated successfully, but these errors were encountered: