Closed izarutskaya closed 1 month ago
Triggered auto assignment to @MitchExpensify (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
We think this issue might be related to the #collect project.
In OPEN_POLICY_TAGS_PAGE command API, we don't set policyTags optimistic data. When enable Tag feature we need to wait BE return policyTags
We should establish default policy tags similar to the response from the backend in the optimistic data of the EnablePolicyTags command API.
{Tag: {name: "Tag", orderWeight: 0, required: false, tags: []}}
Remove policyTag condition
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Job added to Upwork: https://www.upwork.com/jobs/~013fd4c53afba54b03
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External
)
Settings button appears with delay on enabling tags.
Settings button would only show when policyTags data is available. policyTags
data takes some time to be fetched via Onyx, which leads to the delay.
Also, the condition for isLoading
is wrong, it just checks for undefined value of policyTags and not for null. Hence, the loading icon doesn't show while the tags are being fetched.
Method 1:
Update the isLoading condition:
const isLoading = !isOffline && !policyTags;
We should be showing the settings option only when there's at least one tag/if the data is still loading (we can discuss if we want to hide the settings option while the data is loading, and then show it only if the there's at least one tag when the data has loaded).
{(tagList?.length > 0 ?? isLoading) && (
<Button
medium
onPress={navigateToTagsSettings}
icon={Expensicons.Gear}
text={translate('common.settings')}
style={[isSmallScreenWidth && styles.w50]}
/>
)}
We also need to update the width of "Add tag" button when settings button is not showing:
<Button
medium
success
onPress={navigateToCreateTagPage}
icon={Expensicons.Plus}
text={translate('workspace.tags.addTag')}
style={[styles.mr3, isSmallScreenWidth && (tagList?.length > 0 ? styles.w50 : styles.w100)]}
/>
Also, add this in AccessOrNotFoundWrapper in WorkspaceTagsSettingsPage
to handle when link is directly opened:
shouldBeBlocked={(policyTagLists[0]?.tags ?? []).length === 0}
This would show not found page if there's no tag available and user tries to access tag settings page.
Method 2:
Use initialValue
in Onyx and define it as an empty object. Then, while the data is being fetched, an empty object will be used as policyTags.
initialValue: {} as OnyxEntry<OnyxTypes.PolicyTagList>,
Optional:
We can change the navigation to featureRoute instead of initial workspace page:
if (isNarrowLayout) {
setTimeout(() => {
Navigation.navigate(featureRoute);
}, 1000);
return;
}
We are navigating to featureRoute for bigger screens as well in the existing flow.
We can discuss if we want to update the timeout as well, else if 1000 ms is fine then we can keep it the same.
policyTags_
data. And when the policyTags_
is loading, the policyTags
in here is null
, leads to the Settings
button in here is not displayed.Settings
button because: Clicking on the Settings
button will open WorkspaceTagsSettingsPage page. But we can also open this page using the deeplink. That means although we try to prevent user from clicking on Settings
button ( to prevent them from accessing the WorkspaceTagsSettingsPage
as well), they still can access WorkspaceTagsSettingsPage
in other ways without any condition.To do it:
So we just need to remove the policyTags
condition in here.
Then, we can display the loading indicator in WorkspaceTagsSettingsPage
if the policyTags_
data is not avaiable. For example, we can add the below to WorkspaceTagsSettingsPage
:
{isLoading && (
<ActivityIndicator
size={CONST.ACTIVITY_INDICATOR_SIZE.LARGE}
style={[styles.flex1]}
color={theme.spinner}
/>
)}
with isLoading: !PolicyUtils.getTagLists(policyTags)?.[0]
In case of offline mode, we can display the offline page.
Custom tag name
option if isLoading
is true
insteadI updated proposal
Thanks for the proposal @cretadn22 .
I don't think we can optimistically assume {Tag: {name: "Tag", orderWeight: 0, required: false, tags: []}}
to be policyTags. User can update the tag name and disable Tags and reenable it. In that case, server will return the updated tag name.
Thanks for the proposal @ShridharGoel
I am not sure if we want to hide Settings if there are no tags. As of now, we are only hiding Settings if policyTags is not loaded yet. Should we just consider policyTags to determine the Settings page?
Thanks for the proposal @nkdengineer
But we can also open this page using the deeplink. That means although we try to prevent user from clicking on Settings button ( to prevent them from accessing the WorkspaceTagsSettingsPage as well), they still can access WorkspaceTagsSettingsPagein other ways without any condition.
Thanks for bringing this up.
Do we have any other such instances in the app where we use Loading Indicator in RHN? I only have suspicion on how will it behave when user is offline. Should we display offline page if user if offline and the required data is not available?
@sobitneupane You can try to open the note page in offline, the loading indicator is displayed when we are offline. URL example: https://dev.new.expensify.com:8082/r/4122908816096140/notes/16802645/edit
.
@sobitneupane Updated proposal We ought to establish a default policyTag within the optimistic data of the EnablePolicyTags API command. This approach mirrors how we implemented it in the enablePolicyTaxes function. https://github.com/Expensify/App/blob/c19eea65c4688e8f353df6358cfd93761cea79bd/src/libs/actions/Policy.ts#L4203
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
Thanks for the update everyone.
In my opinion, it would be more consistent with the app's design to display the Settings button and show a loading indicator when the Settings button is clicked if the data is not yet available.
Proposal from @nkdengineer looks good to me.
π π π C+ reviewed
Triggered auto assignment to @MonilBhavsar, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@MonilBhavsar does @nkdengineer 's proposal look good to you too? Let's assign if so π
@sobitneupane @MonilBhavsar @MitchExpensify 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!
@sobitneupane, @MonilBhavsar, @MitchExpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
Sorry, since this is owned by C+. I missed it in my K2.
The proposal looks good mostly. I have one concern - how does it work in offline mode? Are we displaying an infinite loader? And as mentioned above, if user is able to access the settings page using deep-link then displaying infinite loader on button does not sound right. A POC could help in this case. Thanks!
@MonilBhavsar
how does it work in offline mode? Are we displaying an infinite loader?
The plan is not to show a loader on the button. Instead, we will display the Settings button regardless of whether data is available. When the user clicks the Settings button, the RHP will open. If data is available, we will show the details; otherwise, we will show the loader.
And as mentioned above, if user is able to access the settings page using deep-link then displaying infinite loader on button does not sound right.
If the user doesn't have access to the settings page, we will show a 'Not Found' page on the RHP. If the user has access to the settings page but the data has not been fetched yet, we will show a loading indicator on the RHP.
@nkdengineer Can you please confirm the details?
@MonilBhavsar The solution is what @sobitneupane said above. The similar logic is the note page. You can try to open the note page in offline, the loading indicator is displayed when we are offline. URL example: https://dev.new.expensify.com:8082/r/4122908816096140/notes/16802645/edit.
@MonilBhavsar @sobitneupane But why should we even show the settings option if policyTags data is not available? Can you check my proposal once?
Thanks for the link and context π
I see in the edit notes page in offline mode, we're displaying infinite loader. That seems confusing UX because loading indicates that we're trying to load something, but infact we're not actually loading anything as user is offline. I think we should display offline page, indicating that user is offline and we're unable to load. Anything we do, we should also fix it at other places. If there are more pages, we can make a different issue. If there's single page, I believe we could do in this issue.
https://github.com/Expensify/App/assets/32012005/4e6971a1-10bf-4182-96ff-56a266fc17aa
This falls under UX pattern D. Please see this flowchart https://github.com/Expensify/App/blob/main/contributingGuides/OFFLINE_UX.md#ux-pattern-flow-chart
@MonilBhavsar I updated the proposal to handle the offline mode.
But why should we even show the settings option if policyTags data is not available?
It does not follow the UI guidelines. We should not hide any button. We should handle the view triggered by the button accordingly, or we can disable the button when offline, if it makes network call. You can refer to this doc https://github.com/Expensify/App/blob/main/contributingGuides/OFFLINE_UX.md
@nkdengineer thanks! Please add separate tests for Offline mode in the PR. And see if we can make a quick fix for notes page, while we're here. It can serve as a wrong inspiration for offline UX, like we did here.
π£ @nkdengineer π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
@MonilBhavsar Do we have the design for the offline screen? Here is the offline screen in the attachment:
Yes, it's this and component is FullPageOfflineBlockingView
@nkdengineer When can we expect the PR?
@sobitneupane PR https://github.com/Expensify/App/pull/42623 is ready
This issue has not been updated in over 15 days. @sobitneupane, @MonilBhavsar, @MitchExpensify, @nkdengineer eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
PR is actively being worked on, looks like it needs your review as a next step @sobitneupane
Reassiging as I'm about to head on paternity leave
Triggered auto assignment to @alexpensify (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
This is noted. I'm taking over and looking at the PR. @nkdengineer, there is some feedback that needs your attention. Thanks!
Thanks, the PR is moving along again through feedback.
Awesome, this one is on staging now and we will wait for automation to run.
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.12-0 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-08-02. :confetti_ball:
For reference, here are some details about the assignees on this issue:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
Payouts due: 2024-08-02
Upwork job is here.
$250 approved for @sobitneupane based on this summary.
If you havenβt already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.4.72-0 Reproducible in staging?: Y Reproducible in production?: Y Logs: https://stackoverflow.com/c/expensify/questions/4856 Issue reported by: Applause-Internal team
Action Performed:
Expected Result:
Settings button will appear immediately.
Actual Result:
Settings button appears after delay.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
https://github.com/Expensify/App/assets/115492554/16034950-0891-441f-a2fe-743433f8fe4f
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @alexpensify