Skip to content

[$500] Web - Workspace - Workspace created in offline mode is not grayed out on Choose a workspace page #35732

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

Closed
1 of 6 tasks
kbecciv opened this issue Feb 2, 2024 · 38 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@kbecciv
Copy link

kbecciv commented Feb 2, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.4.36-0
Reproducible in staging?: y
Reproducible in production?: n
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Go offline
  2. Create new workspace
  3. Navigate to the Choose a workspace page

Expected Result:

Newly created workspace in offline should be grayed out

Actual Result:

Workspace created in offline mode is not grayed out

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6365353_1706909617540.Recording__2017.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0124a63474e95d7dc5
  • Upwork Job ID: 1753546948780208128
  • Last Price Increase: 2024-02-02
@kbecciv kbecciv added the DeployBlockerCash This issue or pull request should block deployment label Feb 2, 2024
Copy link
Contributor

github-actions bot commented Feb 2, 2024

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

Copy link

melvin-bot bot commented Feb 2, 2024

Triggered auto assignment to @tylerkaraszewski (Engineering), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

@kbecciv
Copy link
Author

kbecciv commented Feb 2, 2024

We think that this bug might be related to #wave8-collect-admins
CC @zanyrenney

@kbecciv kbecciv changed the title Workspace - Workspace created in offline mode is not grayed out on Choose a workspace page Web - Workspace - Workspace created in offline mode is not grayed out on Choose a workspace page Feb 2, 2024
@francoisl
Copy link
Contributor

Sounds somewhat similar to #35702.

@francoisl francoisl added the External Added to denote the issue can be worked on by a contributor label Feb 2, 2024
@melvin-bot melvin-bot bot changed the title Web - Workspace - Workspace created in offline mode is not grayed out on Choose a workspace page [$500] Web - Workspace - Workspace created in offline mode is not grayed out on Choose a workspace page Feb 2, 2024
Copy link

melvin-bot bot commented Feb 2, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0124a63474e95d7dc5

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 2, 2024
Copy link

melvin-bot bot commented Feb 2, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (External)

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Feb 2, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Web - Workspace - Workspace created in offline mode is not grayed out on Choose a workspace page

What is the root cause of that problem?

The main problem with issue is that we don't pass pending action
We can't use OfflineWithFeedback without pending action

return Object.values(policies)
.filter((policy) => PolicyUtils.shouldShowPolicy(policy, !!isOffline))
.map((policy) => ({
text: policy?.name,
policyID: policy?.id,
brickRoadIndicator: getIndicatorTypeForPolicy(policy?.id),
icons: [
{
source: policy?.avatar ? policy.avatar : ReportUtils.getDefaultWorkspaceAvatar(policy?.name),
fallbackIcon: Expensicons.FallbackWorkspaceAvatar,
name: policy?.name,
type: CONST.ICON_TYPE_WORKSPACE,
},
],
boldStyle: hasUnreadData(policy?.id),
keyForList: policy?.id,
isPolicyAdmin: PolicyUtils.isPolicyAdmin(policy),
}));

What changes do you think we should make in order to solve the problem?

To fix this issue we can update this function and add a new field

pendingAction: policy?.pendingFields?.generalSettings || policy?.pendingAction

I add pendingFields?.generalSettings because when we update the general setting we add pending action there

But I think we can update optimistic data and add pendingAction field

value: {
...policy,
pendingFields: {
generalSettings: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
},
// Clear errorFields in case the user didn't dismiss the general settings error
errorFields: {
generalSettings: null,
},
name,
outputCurrency: currency,
...(distanceUnit?.customUnitID && distanceRate?.customUnitRateID
? {
customUnits: {
[distanceUnit?.customUnitID]: {
...distanceUnit,
rates: {
[distanceRate?.customUnitRateID]: {
...distanceRate,
currency,
},
},
},
},
}
: {}),

Plus we have problem with OptionRow since we get crash app since we use Hoverable and PressableWithFeedback inside OfflineWithFeedback

<Hoverable>
{(hovered) => (
<PressableWithFeedback
nativeID={keyForList}
ref={pressableRef}
onPress={(e) => {
if (!onSelectRow) {
return;
}
setIsDisabled(true);
if (e) {
e.preventDefault();
}
let result = onSelectRow(option, pressableRef.current);
if (!(result instanceof Promise)) {
result = Promise.resolve();
}
InteractionManager.runAfterInteractions(() => {
result?.finally(() => setIsDisabled(isOptionDisabled));
});
}}
disabled={isDisabled}
style={[
styles.flexRow,
styles.alignItemsCenter,
styles.justifyContentBetween,
styles.sidebarLink,
!isOptionDisabled && styles.cursorPointer,
shouldDisableRowInnerPadding ? null : styles.sidebarLinkInner,
optionIsFocused ? styles.sidebarLinkActive : null,
shouldHaveOptionSeparator && styles.borderTop,
!onSelectRow && !isOptionDisabled ? styles.cursorDefault : null,
]}
accessibilityLabel={option.text}
role={CONST.ROLE.BUTTON}
hoverDimmingValue={1}
hoverStyle={!optionIsFocused ? hoverStyle ?? styles.sidebarLinkHover : undefined}
needsOffscreenAlphaCompositing={(option.icons?.length ?? 0) >= 2}
onMouseDown={shouldPreventDefaultFocusOnSelectRow ? (event) => event.preventDefault() : undefined}
>
<View style={sidebarInnerRowStyle}>

To fix this we need delete Hoverable and use only PressableWithFeedback(In any case we only need hovered state )

Or move OfflineWithFeedback inside Hoverable or PressableWithFeedback

Screenshot 2024-02-03 at 00 17 11

What alternative solutions did you explore? (Optional)

NA

@Tony-MK
Copy link
Contributor

Tony-MK commented Feb 3, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Web - Workspace - Workspace created in offline mode is not grayed out on choosing a workspace page.

What is the root cause of that problem?

In the WorkspaceOverviewPage, the pendingAction for the OfflineWithFeedback component only checks for pendingFields.generalSettings. That is why it only dims when the title is edited because pendingFields.generalSettings is "update".

<OfflineWithFeedback pendingAction={lodashGet(policy, 'pendingFields.generalSettings')}>

<AvatarWithIndicator
source={UserUtils.getAvatar(currentUserPersonalDetails.avatar, currentUserPersonalDetails.accountID)}
tooltipText={translate('common.settings')}

Also, the SidebarUtils.getOptionData function does not check for report.pendingAction and has the value "add" when the policy was created.

Thus, the OptionRowLHNData sidebar component won't dim.

result.pendingAction = report.pendingFields ? report.pendingFields.addWorkspaceRoom || report.pendingFields.createChat : undefined;

<Tooltip text={translate('common.settings')}>
<PressableWithFeedback

What changes do you think we should make in order to solve the problem?

For the WorkspaceOverviewPage, we should modify the pendingAction {lodashGet(policy, 'pendingFields.generalSettings') || lodashGet(policy, 'pendingAction')} of the OfflineWithFeedback component here and if required for the AvatarWithImagePicker over here.

For example :

pendingAction={lodashGet(policy, 'pendingFields.avatar', null)}

pendingAction={lodashGet(policy, 'pendingFields.generalSettings') || lodashGet(policy, 'pendingAction')}

Alternatively, we could wrap the WorkspacePageWithSections component with a OfflineWithFeedback component. Then, use the policy.pendingAction for the pendingAction prop. Finally, set shouldDisableOpacity for the AvatarWithImagePicker and the inner OfflineWithFeedback component if it is present policy.pendingAction to prevent double dimming.

Lastly, for the SidebarUtils.getOptionData function, introduce report.pendingAction in the OR condition which determines result.pendingAction alongside report.pendingFields.addWorkspaceRoom and `report.pendingFields.createChat.

What alternative solutions did you explore? (Optional)

Create a pendingFields attribute for the policy in the onyx and introduce it WorkspaceOverviewPage and SidebarUtils.getOptionData. It will function like createChat and be used like pendingAction in the earlier solution.

@melvin-bot melvin-bot bot added the Overdue label Feb 5, 2024
@mountiny mountiny added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Feb 5, 2024
@melvin-bot melvin-bot bot removed the Overdue label Feb 5, 2024
@mountiny
Copy link
Contributor

mountiny commented Feb 5, 2024

Demoting, not a blocker

@mountiny mountiny added the Bug Something is broken. Auto assigns a BugZero manager. label Feb 5, 2024
Copy link

melvin-bot bot commented Feb 5, 2024

Triggered auto assignment to @kevinksullivan (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@mananjadhav
Copy link
Collaborator

@mountiny @tylerkaraszewski I just reviewed an offline issue for Delete Workspace. Both the issues need different changes, but there might be an overlap such as changing the wrapping order.

But are we planning to consolidate all the new Workspace list offline issues in one? or we can work on these separately?

@mountiny
Copy link
Contributor

mountiny commented Feb 5, 2024

I think we can work on this in one issue, create and delete workspace offline and ensure the feedback is correct.

@hayata-suenaga
Copy link
Contributor

okay that makes sense. then let's handle these issues separately. @mananjadhav please select a proposal when you have time 🙇

@mananjadhav
Copy link
Collaborator

@Tony-MK's proposal looks good to me, as it covers all cases for add workspace.

🎀 👀 🎀 C+ reviewed.

Copy link

melvin-bot bot commented Feb 6, 2024

Current assignee @tylerkaraszewski is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Feb 6, 2024

@Tony-MK's proposal looks good to me, as it covers all cases for add workspace.

🎀 👀 🎀 C+ reviewed.

Sorry, I don't mind your decision
But does it fix the problem in this issue?
Issue related to fix Choose a workspace page (This is WorkspaceSwitcherPage )
In turn, the selected proposal makes changes in a completely different place and doesn't fix the main issue

@hayata-suenaga
Copy link
Contributor

@mananjadhav could you check @ZhenjaHorbach's comment?

@melvin-bot melvin-bot bot added the Overdue label Feb 9, 2024
@mananjadhav
Copy link
Collaborator

I'll check the comment and the proposal again to confirm.

@melvin-bot melvin-bot bot removed the Overdue label Feb 12, 2024
@Tony-MK
Copy link
Contributor

Tony-MK commented Feb 13, 2024

Hey all,

I have to say about this #35732 (comment) which I think should be part of the expected result.

In turn, the selected proposal makes changes in a completely different place

I believe that this is because my proposal included handling the add pending action for the WorkspaceOverviewPage.

Issue related to fix Choose a workspace page (This is WorkspaceSwitcherPage )

Secondly, it also handles the pending action for the WorkspaceSwitcherPage and the Sidebar when the user is on the home screen.

Finally, I believe my solution was less complicated and regression-prone than changing Onyx's data.

@Tony-MK's #35732 (comment) looks good to me, as it covers all cases for add workspace.

Therefore, my proposal should fix all the cases as @mananjadhav stated in this #35732 (comment)

I can provide the test branch if you want to review it.

However, I am happy with the C+'s and engineer's decisions.

Thanks.

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Feb 13, 2024

Hey all,

I have to say about #35732 (comment)

In turn, the selected proposal makes changes in a completely different place

I believe this because my proposal included handling the pending action for the WorkspaceOverviewPage.

Issue related to fix Choose a workspace page (This is WorkspaceSwitcherPage )

Secondly, it also handles the pending action for the WorkspaceSwitcherPage and the Sidebar when the user is on the home screen.

Finally, my solution was less complicated and regression-prone than changing Onyx's data.

@Tony-MK's #35732 (comment) looks good to me, as it covers all cases for add workspace.

Therefore, my proposal should fix all the as @mananjadhav stated in this #35732 (comment)

I can provide the test branch if you want to review it.

However, I am happy with the C+'s and engineer's decisions.

In my proposal I do not indicate that we are obliged to change the onyx's data

And I don't mind if your proposition is better )
It’s just not clear how your proposal fixes WorkspaceSwitcherPage
Although this issue requires it

@Tony-MK
Copy link
Contributor

Tony-MK commented Feb 13, 2024

To fix this issue we can update this function and add a new field

pendingAction: policy?.pendingFields?.generalSettings || policy?.pendingAction

I add pendingFields?.generalSettings because when we update the general setting we add pending action there

But I think we can update optimistic data and add pendingAction field

value: {
...policy,
pendingFields: {
generalSettings: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
},
// Clear errorFields in case the user didn't dismiss the general settings error
errorFields: {
generalSettings: null,
},
name,
outputCurrency: currency,
...(distanceUnit?.customUnitID && distanceRate?.customUnitRateID
? {
customUnits: {
[distanceUnit?.customUnitID]: {
...distanceUnit,
rates: {
[distanceRate?.customUnitRateID]: {
...distanceRate,
currency,
},
},
},
},
}
: {}),

@ZhenjaHorbach, then it seems I did not understand this part, before mentioning the Hoverable. Could you elaborate further?

It’s just not clear how your proposal fixes WorkspaceSwitcherPage

The SidebarUtils.getOptionData function also handles the add pending action for the WorkspaceSwitcherPage.

@ZhenjaHorbach
Copy link
Contributor

To fix this issue we can update this function and add a new field

pendingAction: policy?.pendingFields?.generalSettings || policy?.pendingAction

I add pendingFields?.generalSettings because when we update the general setting we add pending action there

But I think we can update optimistic data and add pendingAction field

value: {
...policy,
pendingFields: {
generalSettings: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
},
// Clear errorFields in case the user didn't dismiss the general settings error
errorFields: {
generalSettings: null,
},
name,
outputCurrency: currency,
...(distanceUnit?.customUnitID && distanceRate?.customUnitRateID
? {
customUnits: {
[distanceUnit?.customUnitID]: {
...distanceUnit,
rates: {
[distanceRate?.customUnitRateID]: {
...distanceRate,
currency,
},
},
},
},
}
: {}),

@ZhenjaHorbach, then it seems I did not understand this part, before mentioning the Hoverable. Could you elaborate further?

It’s just not clear how your proposal fixes WorkspaceSwitcherPage

The SidebarUtils.getOptionData function also handles the add pending action for the WorkspaceSwitcherPage.

We don't use SidebarUtils.getOptionData inside WorkspaceSwitcherPage )

This is an idea to update, but I have already proposed an option without Onyx changes

Screenshot 2024-02-13 at 23 42 56

@Tony-MK
Copy link
Contributor

Tony-MK commented Feb 13, 2024

We don't use SidebarUtils.getOptionData inside WorkspaceSwitcherPage )

@ZhenjaHorbach, we do. It works. It will also handle the home screen.

Also, I think we need to fix the WorkspaceOverviewPage as well.

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Feb 13, 2024

We don't use SidebarUtils.getOptionData inside WorkspaceSwitcherPage )

@ZhenjaHorbach, we do. It works. It will also handle the home screen.

Also, I think we need to fix the WorkspaceOverviewPage as well.

In WorkspaceSwitcherPage we use only OptionRow instead of OptionRowLHNData (And here we use SidebarUtils.getOptionData)
So any changes related to SidebarUtils.getOptionData will not cause any effect on OptionRow

Sorry, if I'm wrong, but can you double-check ?)
Because I think your changes won't change anything in WorkspaceSwitcherPage

@Tony-MK
Copy link
Contributor

Tony-MK commented Feb 13, 2024

It should work because I have tested it.

However, let's hear the C+'s decision.

@mananjadhav
Copy link
Collaborator

Folks I was finishing up some PRs, and I'll be focusing on this one today. Please bear with me for one day.

Copy link

melvin-bot bot commented Feb 16, 2024

@tylerkaraszewski @mananjadhav @kevinksullivan this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Feb 16, 2024
Copy link

melvin-bot bot commented Feb 19, 2024

@tylerkaraszewski, @mananjadhav, @kevinksullivan Eep! 4 days overdue now. Issues have feelings too...

@mananjadhav
Copy link
Collaborator

I checked the comments/proposals again, and I can see the code has changed since we last reviewed. @Tony-MK @ZhenjaHorbach do either of you want to revise their proposals?

@melvin-bot melvin-bot bot removed the Overdue label Feb 19, 2024
@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

@melvin-bot melvin-bot bot added the Overdue label Feb 22, 2024
@kevinksullivan
Copy link
Contributor

Closing out unless this is reproducible again after the mentioned changes.

@Tony-MK
Copy link
Contributor

Tony-MK commented Feb 25, 2024

@kevinksullivan, this issue is still reproducible on the latest main branch.

Furthermore, once a workspace is created, the workspace settings page should grayed out.

Similar to when a workspace name is updated.

Could we confirm this?

Thank you

@kevinksullivan
Copy link
Contributor

Hm I'm actually not sure what's going on here. I am seeing some workspaces I created previously grayed out, and some aren't while offline. What is the expected behavior?

image

@Tony-MK
Copy link
Contributor

Tony-MK commented Mar 5, 2024

The expected result of graying out the options in the workspace switcher is wrong.

I suppose there was confusion about highlighting the focused option and pending action.

However, is it true that when the workspace is created, the workspace's initial page should grayed out?

Similarly, when a workspace name is updated.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

10 participants