Skip to content

Category - Subcategory with empty parent can be created #85361

Closed

Description

@jponikarchuk

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: 9.3.38-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #83200
Email or phone of affected tester (no customers): sdijnsoijsodosj@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Create this category - :D
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Click + > Create expense > Manual.
  4. Enter amount > Next.
  5. Click Category.

Expected Result:

:D will be the category.

Actual Result:

D is the category, with spacing in front, which means that it is a subcategory with empty parent.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Video.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 16, 2026
  2. melvin-bot commented on Mar 16, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #83200

  3. melvin-bot commented on Mar 16, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on Mar 16, 2026

    @github-actions
    Contributor

    👋 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.
  5. OSBotify commented on Mar 16, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #83200 - "Multi-level categories with colons are shown with hierarchical indentation" by @ijmalik (High confidence)
    Related Issues: #82068 (original issue that PR #83200 fixed)

    Recommendation: REVERT

    PR #83200 introduces a regression that breaks category names starting with colons. While the PR successfully adds hierarchical indentation for multi-level categories (e.g., Primary:Secondary:Tertiary), it causes category names like :D to be incorrectly parsed as subcategories with empty parents.

    Labels: Keeping DeployBlockerCash (App deploy is blocked by a frontend bug). No label changes needed as this is correctly classified as a frontend deploy blocker.

    📋 Detailed Analysis

    Evidence

    PR #83200 changed PARENT_CHILD_SEPARATOR from ': ' (colon with space) to ':' (just colon) to enable hierarchical display of categories. This change causes the bug:

    1. When a category named :D is processed, the code splits it by : separator
    2. The split produces an array: ['', 'D'] (empty string + D)
    3. The empty string is treated as a parent category, and D as a child
    4. The display logic adds indentation, showing D with spacing as if it's a subcategory

    Verification

    Root Cause

    In CategoryOptionListUtils.ts line 36, the code splits category names:

    const array = option.name.split(CONST.PARENT_CHILD_SEPARATOR);

    When PARENT_CHILD_SEPARATOR is ':' and the category name is :D, this produces ['', 'D']. The empty string at index 0 is treated as a parent category, and the iteration creates an indented display for D as if it's a child of an empty parent.

    The original separator ': ' (colon with space) would not have this issue with single-colon names, but the change was necessary for proper hierarchical display of legitimate multi-level categories like Primary:Secondary:Tertiary.

  6. MelvinBot commented on Mar 16, 2026

    @MelvinBot
    Contributor

    Proposal

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

    A category named :D (an emoticon) displays as D with leading indentation, making it appear as a subcategory with an empty parent. The colon in the name is incorrectly interpreted as a hierarchy separator.

    What is the root cause of that problem?

    PR #83200 changed PARENT_CHILD_SEPARATOR from ': ' (colon-space) to ':' (bare colon) in src/CONST/index.ts:6053.

    In getCategoryOptionTree, category names are split on this separator at line 36:

    ":D".split(":")  →  ["", "D"]
    

    With the old separator ': ', this split would produce [":D"] (no split, because there's no ": " in :D), and the category would display correctly as a top-level item.

    With the new separator ':', the split produces an empty string at index 0. The falsy guard at line 40 skips the empty segment via continue, but "D" at index 1 still inherits index=1 indentation (4 spaces) from the times(index, ...) call at line 44. The result is D — displayed as an indented subcategory with no visible parent.

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

    In getCategoryOptionTree in src/libs/CategoryOptionListUtils.ts, replace the use of the raw array index for indentation with a separate depth counter that only increments for non-empty segments. When a segment from the split is empty (falsy), it should be skipped without advancing the depth. This way :D would split to ["", "D"], skip the empty segment, and render D at depth 0 (no indentation) — correctly treating it as a top-level category.

    The same logic would also handle other edge cases like ::name (double colon) or names with consecutive colons.

    What alternative solutions did you explore? (Optional)

    Revert PARENT_CHILD_SEPARATOR back to ': ': This would fix :D because ":D".split(": ") = [":D"], but it could re-introduce the issue from #82068 if the server ever sends category hierarchies without the space (e.g., "Food:Meat"). The depth-counter approach is more robust because it keeps the bare ':' separator while correctly handling edge cases.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  7. ZhenjaHorbach commented on Mar 16, 2026

    @ZhenjaHorbach
    Contributor

    The same behaviour is in OD

    Image
  8. ZhenjaHorbach commented on Mar 16, 2026

    @ZhenjaHorbach
    Contributor

    @Expensify/design
    Could you clarify this issue?
    I suppose it's not a bug since we have the same behaviour in OD

    CC: @ijmalik

  9. shawnborton commented on Mar 16, 2026

    @shawnborton
    Contributor

    Curious what @Expensify/product thinks, but I think it's okay if we mirror what we have in OD here.

  10. ZhenjaHorbach commented on Mar 16, 2026

    @ZhenjaHorbach
    Contributor

    So
    Let's just close this issue
    Since it's the same behaviour as in OD

  11. IuliiaHerets commented on Mar 16, 2026

    @IuliiaHerets

    Windows 10 / Chrome
    Not Repro
    v9.3.38-1

    bandicam.2026-03-16.14-59-29-446.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions