Skip to content

[HOLD for payment 2024-05-03] [$500] [Workflows] Workspace - "Hmm it's not here" error appears briefly when enabling workflows #39443

Closed

Description

@lanitochka17

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.59.0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4468674&group_by=cases:section_id&group_order=asc&group_id=283225
Issue reported by: Applause - Internal Team

Action Performed:

  1. Log in with a new expensifail account
  2. Create a workspace
  3. Navigate to Workspace settings - More features
  4. Enable workflows

Expected Result:

I shouldn't be getting any errors

Actual Result:

"Hmm it's not here" error appears briefly when enabling workflows for the first time

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

Bug6435811_1712077387579.bandicam_2024-04-02_18-58-32-923.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f589bc2448420016
  • Upwork Job ID: 1775643123069042688
  • Last Price Increase: 2024-04-10
  • Automatic offers:
    • hungvu193 | Reviewer | 0
    • ZhenjaHorbach | Contributor | 0

Activity

  1. added
    Daily
    Bug
    on Apr 2, 2024
  2. melvin-bot commented on Apr 2, 2024

    @melvin-bot

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

  3. lanitochka17 commented on Apr 2, 2024

    @lanitochka17
    Author

    @puneetlath FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

  4. ZhenjaHorbach commented on Apr 3, 2024

    @ZhenjaHorbach
    Contributor

    Proposal

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

    "Hmm it's not here" error appears briefly when enabling workflows

    What is the root cause of that problem?

    The main problem with issue is that when we create a new workspace we are waiting for a response from the server
    And if during this period of time we enable PolicyWorkflows we will add enablePolicyWorkflows to the queue

    But after enabling PolicyWorkflows we will navigate to the PolicyWorkflows screen and make request to get current state of policy which is still disabled

    As result we will have here is list of event

    1. Create workspace ( PolicyWorkflows is disabled) (API.write)
    2. Press on the radio button ( PolicyWorkflows is enabled) (API.write) - still waiting first event
    3. Navigate to the PolicyWorkflows screen
    4. Get answer from create workspace ( PolicyWorkflows is disabled) (At this moment we have the issue)
    5. Get answer from changing state of PolicyWorkflows(PolicyWorkflows is enabled)
    Screenshot 2024-04-03 at 11 35 24

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

    To fix this issue we can update our FeatureEnabledAccessOrNotFoundComponent and depending on pendingFields(which we will change after press on radio button) we will update our policyFeature to prevent unnecessary changes while we are waiting for a response from the server

    function FeatureEnabledAccessOrNotFoundComponent(props: FeatureEnabledAccessOrNotFoundComponentProps) {
    const isPolicyIDInRoute = !!props.policyID?.length;
    const shouldShowFullScreenLoadingIndicator = props.isLoadingReportData !== false && (!Object.entries(props.policy ?? {}).length || !props.policy?.id);
    const shouldShowNotFoundPage = isEmptyObject(props.policy) || !props.policy?.id || !PolicyUtils.isPolicyFeatureEnabled(props.policy, props.featureName);
    useEffect(() => {
    if (!isPolicyIDInRoute || !isEmptyObject(props.policy)) {
    // If the workspace is not required or is already loaded, we don't need to call the API
    return;
    }
    Policy.openWorkspace(props.policyID, []);
    // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [isPolicyIDInRoute, props.policyID]);

        const isPolicyIDInRoute = !!props.policyID?.length;
        const [isPolicyFeatureEnabled, setIsPolicyFeatureEnabled] = useState(PolicyUtils.isPolicyFeatureEnabled(props.policy, props.featureName));
        const shouldShowFullScreenLoadingIndicator = props.isLoadingReportData !== false && (!Object.entries(props.policy ?? {}).length || !props.policy?.id);
        const shouldShowNotFoundPage = isEmptyObject(props.policy) || !props.policy?.id || !isPolicyFeatureEnabled;
        const {isOffline} = useNetwork();
    
        useEffect(() => {
            if (!isPolicyIDInRoute || !isEmptyObject(props.policy)) {
                // If the workspace is not required or is already loaded, we don't need to call the API
                return;
            }
    
            Policy.openWorkspace(props.policyID, []);
            // eslint-disable-next-line react-hooks/exhaustive-deps
        }, [isPolicyIDInRoute, props.policyID]);
    
    
        useEffect(() => {
            if (props.policy?.pendingFields?.[props.featureName] === 'update' && !PolicyUtils.isPolicyFeatureEnabled(props.policy, props.featureName) && !isOffline) {
                return;
            }
            setIsPolicyFeatureEnabled(PolicyUtils.isPolicyFeatureEnabled(props.policy, props.featureName));
        }, [props.policy?.pendingFields?.[props.featureName], PolicyUtils.isPolicyFeatureEnabled(props.policy, props.featureName)]);
    

    Here we add useState and useEffect. And only when props.policy?.pendingFields?.[props.featureName] will be null we will update isPolicyFeatureEnabled to be sure that we receive only current data from the server

    What alternative solutions did you explore? (Optional)

    As alternative we can show isLoading while we are waiting answer from server

    In case of offline mode we will not use pendingFields
    Since I mentioned that the issue is related to the server response
    In this case, displaying content will work as expected

    const shouldShowFullScreenLoadingIndicator = props.isLoadingReportData !== false && (!Object.entries(props.policy ?? {}).length || !props.policy?.id);

        const shouldShowFullScreenLoadingIndicator =
            (props.isLoadingReportData !== false && (!Object.entries(props.policy ?? {}).length || !props.policy?.id)) ||
            (props.policy?.pendingFields?.[props.featureName] === 'update' && !isOffline);
    
  5. added
    External
    on Apr 3, 2024
  6. melvin-bot commented on Apr 3, 2024

    @melvin-bot
  7. changed the title [-]Workspace - "Hmm it's not here" error appears briefly when enabling workflows[/-] [+][$500] Workspace - "Hmm it's not here" error appears briefly when enabling workflows[/+] on Apr 3, 2024
  8. added
    Help Wanted
    on Apr 3, 2024
  9. melvin-bot commented on Apr 3, 2024

    @melvin-bot

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

  10. hungvu193 commented on Apr 4, 2024

    @hungvu193
    Contributor

    Hey! How can I re-enable workflow once I enabled it?

    Screen.Recording.2024-04-04.at.10.05.49.mov
  11. ZhenjaHorbach commented on Apr 4, 2024

    @ZhenjaHorbach
    Contributor

    Hey! How can I re-enable workflow once I enabled it?

    Screen.Recording.2024-04-04.at.10.05.49.mov

    Do you mean to open more features ?
    And then turn workflows off and on ?)

  12. hungvu193 commented on Apr 4, 2024

    @hungvu193
    Contributor

    Hey! How can I re-enable workflow once I enabled it?
    Screen.Recording.2024-04-04.at.10.05.49.mov

    Do you mean to open more features ? And then turn workflows off and on ?)

    Oh god 🤦 , silly me. Thank you.

  13. 63 remaining items

  14. added
    Weekly
    Awaiting Payment
    on Apr 26, 2024
  15. changed the title [-][$500] [Workflows] Workspace - "Hmm it's not here" error appears briefly when enabling workflows[/-] [+][HOLD for payment 2024-05-03] [$500] [Workflows] Workspace - "Hmm it's not here" error appears briefly when enabling workflows[/+] on Apr 26, 2024
  16. melvin-bot commented on Apr 26, 2024

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  17. removed
    Reviewing
    on Apr 26, 2024
  18. melvin-bot commented on Apr 26, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.66-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2024-05-03. 🎊

    For reference, here are some details about the assignees on this issue:

  19. melvin-bot commented on Apr 26, 2024

    @melvin-bot

    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:

    • [@hungvu193] The PR that introduced the bug has been identified. Link to the PR:
    • [@hungvu193] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
    • [@hungvu193] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
    • [@hungvu193] Determine if we should create a regression test for this bug.
    • [@hungvu193] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@puneetlath] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  20. puneetlath commented on May 1, 2024

    @puneetlath
    Contributor

    @hungvu193 friendly reminder on the checklist so that we can pay in a couple days.

  21. hungvu193 commented on May 2, 2024

    @hungvu193
    Contributor

    This is new feature and we're still developing it so I don't think we need regression test for this one.

  22. puneetlath commented on May 3, 2024

    @puneetlath
    Contributor

    All paid. Thanks y'all!

  23. added
    Reviewing
    Weekly
    and removed
    Weekly
    on Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugExternalReviewingWeekly

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions