You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$175] [Sentry: APP-JKQ] Web: BaseGenericTooltip loops into "Maximum update depth exceeded" in Search expense report rows #105707
Sentry shows UpdateRequiredView/index.tsx:78 as the most relevant frame. That frame looks like a source map mismatch, so the component stack above is the reliable signal.
Suspected cause
BaseGenericTooltip measures its content in a mount useLayoutEffect and then calls setContentMeasuredWidth and setWrapperMeasuredHeight (src/components/Tooltip/BaseGenericTooltip/index.tsx:69 on main). The effect has empty dependencies, so the loop means the tooltip remounts on each update inside the Search expense report rows. Needs investigation, starting with what remounts the tooltip in ExpenseReportListItemRowWide.
Reproduction
Unknown. See the Sentry events linked from the Sentry issue. The crash happens while the Search expense report list renders a row tooltip.
Confidence: medium on why the tooltip gets blamed. Low on what drives the loop: I couldn't open the Sentry events (the Sentry connection failed), and I don't have a reproduction yet.
What is the root cause of that problem?
BaseGenericTooltip is where React throws, but it isn't what causes the loop. Its layout effect has empty dependencies and runs once per mount (BaseGenericTooltip/index.tsx:69-83), so it can't loop by itself. It shows up in the stack because it remounts on every commit of a loop that something else starts:
Hovering a cell in the row sets isRendered = true in GenericTooltip. Hiding the tooltip never sets it back to false, so the hidden tooltip stays mounted (GenericTooltip.tsx:95-97, 164-177).
The tooltip's key includes text (GenericTooltip.tsx:194-212). FlashList reuses row components for other items and keeps their state, so a reused row gets new text while isRendered is still true. The tooltip then remounts in that same commit and its mount effect calls setState again.
Something keeps re-laying out the Search list in sync layout effects. My best guess is FlashList's web layout loop, which the repo has already patched twice for React Add link styles for sidebar footer #185 (patches/@shopify/flash-list/details.md). Each pass reassigns rows, so the tooltip remounts each time. Child layout effects run first, so when the nested update count passes 50, the tooltip's setState is the one that throws.
What changes do you think we should make in order to solve the problem?
In GenericTooltip, stop keeping a hidden tooltip mounted when its key changes. Compute the key once. If it changes while isVisible is false, set isRendered back to false during render. This stops reused rows from remounting tooltips, and it removes BaseGenericTooltip from the loop.
Before you merge, reproduce the case and check whether the crash just moves to a new top frame, such as FlashList setRenderId. To reproduce: open /r/:reportID with the Search expense report list next to the RHP, use classic (non-overlay) scrollbars, hover a cell, then resize the RHP or window. If the crash moves, the FlashList measurement loop needs its own fix. Check whether the recently merged Fix report table header is larger than rest of the table (FlashList patch 017) already covers it.
What alternative solutions did you explore? (Optional)
Add guards to the BaseGenericTooltip effect (for example, skip the update when values are equal). Rejected: every fresh mount starts at undefined, so a guard never skips anything.
Reset isRendered when the hide animation ends. This works too, but it's blunter. Every hover would remount the tooltip.
Render BaseGenericTooltip only while isVisible is true. Rejected: it cuts off the hide animation.
Investigation details
Rows that render tooltips: TextWithTooltip in the date, text, total, and workspace cells, and the StatusBadge tooltip (ExpenseReportListItemRowWide.tsx:78-200). All of them appear only on hover. None shows on mount, so the tooltip mounts only after a hover.
AvatarTooltipsProvider only provides context. It has no state or effects, so it's ruled out (AvatarTooltipContext.tsx:15-17).
BoundsObserver also calls setState during commit when its callback identity changes. Those calls run in class lifecycles, not commitHookEffectListMount, so it isn't the reported frame.
No single regressing PR is confirmed. The crash group has been seen at low volume since 2026-07-30.
Useful Sentry data to confirm the driver: other Add link styles for sidebar footer #185 events with the same component stack but a FlashList top frame, breadcrumbs (hover, then RHP resize or scroll), and OS tags (Windows or Linux means classic scrollbars).
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/105707) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
The crash is caused by a cyclic remount-and-measure loop between GenericTooltip, BaseGenericTooltip, and FlashList row recycling:
Persistent isRendered in GenericTooltip:
In src/components/Tooltip/GenericTooltip.tsx:95-97, hovering a cell calls showTooltip, which sets setIsRendered(true) and setIsVisible(true).
When the tooltip is hidden in hideTooltip (GenericTooltip.tsx:146-158), setIsVisible(false) is set, but isRendered is never reset to false. It remains permanently true.
Aggressive Key-Based Remounting on Recycled Rows:
In GenericTooltip.tsx:175-194:
Because isRendered remains true indefinitely on once-hovered rows, when the user scrolls the Search list and FlashList recycles rows, the row's text or data changes. The dynamic key immediately unmounts and remounts BaseGenericTooltip for hidden tooltips.
Synchronous useLayoutEffect State Cascades:
On every mount, BaseGenericTooltip (src/components/Tooltip/BaseGenericTooltip/index.tsx:69-83) executes useLayoutEffect:
Calling setContentMeasuredWidth and setWrapperMeasuredHeight synchronously schedules immediate re-renders during the commit phase. Across recycled rows in ExpenseReportListItemRowWide and AvatarTooltipsProvider, these synchronous layout updates cause parent list containers to re-measure, triggering further cell updates and immediate remounts. React detects over 50 nested commits within the same cycle and throws Error: Maximum update depth exceeded.
What changes do you think we should make in order to solve the problem?
Unmount Inactive Hidden Tooltips in GenericTooltip.tsx:
In src/components/Tooltip/GenericTooltip.tsx:
Reset setIsRendered(false) once the hide animation completes (or immediately in hideTooltip if animations are bypassed).
Only render BaseGenericTooltip while the tooltip is visible or animating:
This ensures that recycled FlashList rows do not mount hidden BaseGenericTooltip instances or execute measurement layout effects when the user is simply scrolling.
Add Equality Guards to Layout State Updates in BaseGenericTooltip/index.tsx:
In src/components/Tooltip/BaseGenericTooltip/index.tsx:78-79, prevent unnecessary state dispatch if measurements haven't changed:
What alternative solutions did you explore? (Optional)
Switching useLayoutEffect to useEffect:
While moving state updates to useEffect avoids the synchronous depth crash, it causes noticeable visual layout flicker because tooltips render at 0/default bounds before repainting at their measured size. Resetting isRendered on hidden tooltips is the proper architectural solution.
Removing the dynamic key on BaseGenericTooltip:
Removing the key avoids full component unmounts, but risks retaining stale content measurements when text length changes significantly. Unmounting hidden tooltips and equality-guarding measurement updates provides both safety and measurement accuracy.
What automated tests can you add to prevent this from re-occurring?
In tests/unit/GenericTooltipTest.tsx:
Hidden Tooltip Unmount Test:
Verify that calling hideTooltip() unmounts BaseGenericTooltip so that subsequent prop/text changes on the parent row do not trigger useLayoutEffect or measurement state updates.
Measurement Depth Stress Test:
Simulate rapid text prop updates on a mounted GenericTooltip container and assert that state transitions settle cleanly without exceeding React's maximum update depth.
Please re-state the problem that we are trying to solve in this issue.
On web, scrolling or interacting with Search expense report rows (or list views rendering tooltips in recycled rows) crashes the app with a fatal React error: Error: Maximum update depth exceeded (React #185) originating from BaseGenericTooltip's useLayoutEffect measurement updates.
What is the root cause of that problem?
The issue stems from a combination of retained lazy-render state in GenericTooltip, key-based unmounting/remounting on recycled list rows, and synchronous state updates in useLayoutEffect:
Stale isRendered on hidden tooltips:
In src/components/Tooltip/GenericTooltip.tsx:95-97, showTooltip sets setIsRendered(true) and setIsVisible(true). When the mouse leaves the cell, hideTooltip (lines 146-158) sets setIsVisible(false) and scales the tooltip to 0, but isRendered permanently remains true.
FlashList row recycling triggers hidden tooltip remounting:
In GenericTooltip.tsx:203:
When the user scrolls the Search list, FlashList recycles row components and updates row data (text prop). Because isRendered is still true, the changed key forces React to completely unmount and remount BaseGenericTooltip for hidden (closed) tooltips.
Synchronous layout cascade in BaseGenericTooltip:
On every remount of BaseGenericTooltip (src/components/Tooltip/BaseGenericTooltip/index.tsx:69-83), useLayoutEffect runs synchronously:
Calling setState unconditionally inside useLayoutEffect triggers an immediate commit and re-render during layout phase. When FlashList recycles multiple rows during scrolling or container resize, mounting and measuring dozens of hidden tooltips in synchronous layout effects causes cascading re-renders that exceed React's 50-update nested depth limit, crashing the app into the error boundary.
What changes do you think we should make in order to solve the problem?
1. Unmount hidden tooltips on content/key change in src/components/Tooltip/GenericTooltip.tsx:
When isVisible is false (the tooltip is closed/hidden) and the row is recycled or its text changes (prevText !== text), reset isRendered to false:
While the tooltip is open or animating, isVisible is true, so this effect does nothing.
When the tooltip is closed and FlashList reuses the row for a different item, isRendered becomes false. BaseGenericTooltip is cleanly unmounted, completely eliminating hidden tooltip measurement and layout effects during list scrolling.
When the user subsequently hovers over the cell, showTooltip() sets setIsRendered(true) and setIsVisible(true), mounting and measuring fresh dimensions accurately.
2. Add equality guards to measurement updates in src/components/Tooltip/BaseGenericTooltip/index.tsx:
In useLayoutEffect (src/components/Tooltip/BaseGenericTooltip/index.tsx:78-79), ensure state is only dispatched if the measured dimensions actually differ from current state:
What alternative solutions did you explore? (Optional)
Conditionally rendering BaseGenericTooltip only while isVisible is true ({shouldRender && isRendered && isVisible && <BaseGenericTooltip />}):
Explored, but rejected because this immediately unmounts the component on mouse leave, abruptly cutting off the fade-out/scale-down animation and causing visual flickering. Resetting isRendered only when !isVisible AND content changes (prevText !== text) allows the exit animation to complete smoothly while guaranteeing that recycled rows never measure inactive tooltips.
Switching useLayoutEffect to useEffect in BaseGenericTooltip:
Rejected because moving initial measurement to useEffect introduces visible layout shift/flickering as tooltips render with undefined dimensions on the initial paint before snapping into place.
What automated tests can you add to prevent this from re-occurring?
In tests/unit/GenericTooltipTest.tsx:
Recycled Row Test: Render GenericTooltip with initial text "Item A". Call showTooltip() and then hideTooltip(). Change the text prop to "Item B" while isVisible is false. Verify that BaseGenericTooltip is not mounted.
Re-hover Test: Following the test above, call showTooltip(). Verify that BaseGenericTooltip mounts and renders with "Item B".
Please re-state the problem that we are trying to solve in this issue.
In Search expense report rows, hover interactions and tooltip layout calculations cause an infinite render loop, crashing the web app with Error: Maximum update depth exceeded in BaseGenericTooltip.
What is the root cause of that problem?
In BaseGenericTooltip/index.tsx:
When target components trigger tooltip measurements in onLayout or hover events, updateTargetBounds calls setTargetBounds(newBounds) on every layout pass.
In search expense tables with dynamic cell widths and responsive containers, updating state triggers a parent row re-layout, which invokes onLayout again with newly generated object references (even when coordinates have not changed), creating an infinite setState loop.
What changes do you think we should make in order to solve the problem?
In BaseGenericTooltip/index.tsx:
Add a shallow equality check comparing previous bounds (x, y, width, height) before updating targetBounds state. If coordinates are identical within a sub-pixel threshold, do not invoke setTargetBounds.
Wrap layout recalculation callbacks in useCallback and debounce measurement calls during rapid hover transitions.
What alternative solutions did you explore? (Optional)
Using CSS-only tooltips for search rows, but maintaining BaseGenericTooltip preserves accessibility attributes and consistent tooltip styling across all platforms.
Please re-state the problem that we are trying to solve in this issue.
In the Search expense report view (ExpenseReportListItemRowWide), rendering cells with tooltips (DateCell, TotalCell, etc.) can enter an infinite React render/layout loop throwing Error: Maximum update depth exceeded (React #185) in BaseGenericTooltip.
What is the root cause of that problem?
In TextWithTooltip/index.tsx, text truncation is measured in onLayout by checking whether scrollWidth > offsetWidth or scrollHeight > offsetHeight, which conditionally triggers setShowTooltip(true).
When showTooltip becomes true, Tooltip/index.tsx conditionally switches from returning children directly to wrapping them in <BaseTooltip {...props}>{children}</BaseTooltip>. <BaseTooltip> wraps children inside <BoundsObserver> and <Hoverable> (a View container).
This change in DOM/parent hierarchy alters the bounding box and flex styling around the inner <Text>, which immediately dispatches another onLayout event. In table rows where column widths sit right at the boundary threshold, the wrapped layout evaluates scrollWidth <= offsetWidth, causing setShowTooltip(false).
When showTooltip becomes false, Tooltip/index.tsx unmounts <BaseTooltip>, removing the wrapper and returning children directly. This unmounting triggers yet another onLayout event on <Text>, re-evaluating scrollWidth > offsetWidth and calling setShowTooltip(true) again.
Each remount of BaseGenericTooltip runs useLayoutEffect, which calls setContentMeasuredWidth and setWrapperMeasuredHeight synchronously during the commit phase. Because this mount/unmount cycle repeats on every layout event without settling, React rapidly hits its recursive update threshold and crashes with Maximum update depth exceeded.
What changes do you think we should make in order to solve the problem?
In src/components/Tooltip/types.ts and src/components/Tooltip/BaseTooltip/index.tsx:
Add shouldRender to SharedTooltipProps / TooltipProps and pass it down to <GenericTooltip shouldRender={shouldRender} {...props}>.
Update src/components/Tooltip/index.tsx to always render <BaseTooltip shouldRender={shouldRender} {...props}>{children}</BaseTooltip> rather than unmounting the wrapper tree when shouldRender is false. GenericTooltip already handles shouldRender natively to determine whether the tooltip bubble/overlay should be rendered (hasTooltipContent && shouldRender && isRendered), allowing the child element's DOM wrapper hierarchy to remain completely stable across truncation checks.
In src/components/TextWithTooltip/index.tsx:
In onLayout, guard the state setter with an identity check: only call setShowTooltip when the computed truncation state differs from previous state: setShowTooltip((prev) => (prev !== isTruncated ? isTruncated : prev)).
Include a 1px threshold (scrollWidth - offsetWidth > 1) to eliminate subpixel rounding jitter on browser fractional zooms and responsive resize.
What alternative solutions did you explore? (Optional)
Adding key resets in GenericTooltip: this causes remounting of tooltips rather than preventing the layout feedback oscillation.
Using useEffect instead of useLayoutEffect in BaseGenericTooltip: this causes visible positioning flicker on web when the tooltip first appears.
What automated tests can you add to prevent this from re-occurring?
In tests/unit/components/TooltipStableRenderTest.tsx, add a unit test that renders Tooltip with a monitored child component, toggles shouldRender between false and true multiple times, and verifies that the child component maintains a stable mount count of 1 without remounting or causing recursive update cycles.
@gijoe0295 are you planning to add the Help Wanted label? i reproduced the crash, traced the update loop, and prepared a tested fix. if contributions are open, i can submit the proposal.
Activity
melvin-bot commentedon Nov 3, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 (
External)[-][Sentry: APP-JKQ] Web: BaseGenericTooltip loops into "Maximum update depth exceeded" in Search expense report rows[/-][+][$175] [Sentry: APP-JKQ] Web: BaseGenericTooltip loops into "Maximum update depth exceeded" in Search expense report rows[/+]melvin-bot commentedon Nov 3, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022117475152829769829
MelvinBot commentedon Nov 3, 2026
Proposal
What is the root cause of that problem?
BaseGenericTooltipis where React throws, but it isn't what causes the loop. Its layout effect has empty dependencies and runs once per mount (BaseGenericTooltip/index.tsx:69-83), so it can't loop by itself. It shows up in the stack because it remounts on every commit of a loop that something else starts:isRendered = trueinGenericTooltip. Hiding the tooltip never sets it back to false, so the hidden tooltip stays mounted (GenericTooltip.tsx:95-97,164-177).keyincludestext(GenericTooltip.tsx:194-212). FlashList reuses row components for other items and keeps their state, so a reused row gets newtextwhileisRenderedis still true. The tooltip then remounts in that same commit and its mount effect callssetStateagain.patches/@shopify/flash-list/details.md). Each pass reassigns rows, so the tooltip remounts each time. Child layout effects run first, so when the nested update count passes 50, the tooltip'ssetStateis the one that throws.What changes do you think we should make in order to solve the problem?
GenericTooltip, stop keeping a hidden tooltip mounted when its key changes. Compute the key once. If it changes whileisVisibleis false, setisRenderedback to false during render. This stops reused rows from remounting tooltips, and it removesBaseGenericTooltipfrom the loop.setRenderId. To reproduce: open/r/:reportIDwith the Search expense report list next to the RHP, use classic (non-overlay) scrollbars, hover a cell, then resize the RHP or window. If the crash moves, the FlashList measurement loop needs its own fix. Check whether the recently merged Fix report table header is larger than rest of the table (FlashList patch 017) already covers it.What alternative solutions did you explore? (Optional)
BaseGenericTooltipeffect (for example, skip the update when values are equal). Rejected: every fresh mount starts atundefined, so a guard never skips anything.isRenderedwhen the hide animation ends. This works too, but it's blunter. Every hover would remount the tooltip.BaseGenericTooltiponly whileisVisibleis true. Rejected: it cuts off the hide animation.Investigation details
TextWithTooltipin the date, text, total, and workspace cells, and theStatusBadgetooltip (ExpenseReportListItemRowWide.tsx:78-200). All of them appear only on hover. None shows on mount, so the tooltip mounts only after a hover.AvatarTooltipsProvideronly provides context. It has no state or effects, so it's ruled out (AvatarTooltipContext.tsx:15-17).BoundsObserveralso callssetStateduring commit when its callback identity changes. Those calls run in class lifecycles, notcommitHookEffectListMount, so it isn't the reported frame.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/105707)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
camesenin commentedon Nov 3, 2026
melvin-bot commentedon Nov 3, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
kevinjosh10 commentedon Nov 3, 2026
Proposal
What is the root cause of that problem?
The crash is caused by a cyclic remount-and-measure loop between
GenericTooltip,BaseGenericTooltip, and FlashList row recycling:Persistent
isRenderedinGenericTooltip:In
src/components/Tooltip/GenericTooltip.tsx:95-97, hovering a cell callsshowTooltip, which setssetIsRendered(true)andsetIsVisible(true).When the tooltip is hidden in
hideTooltip(GenericTooltip.tsx:146-158),setIsVisible(false)is set, butisRenderedis never reset tofalse. It remains permanentlytrue.Aggressive Key-Based Remounting on Recycled Rows:
In
GenericTooltip.tsx:175-194:Because
isRenderedremainstrueindefinitely on once-hovered rows, when the user scrolls the Search list and FlashList recycles rows, the row'stextor data changes. The dynamickeyimmediately unmounts and remountsBaseGenericTooltipfor hidden tooltips.Synchronous
useLayoutEffectState Cascades:On every mount,
BaseGenericTooltip(src/components/Tooltip/BaseGenericTooltip/index.tsx:69-83) executesuseLayoutEffect:Calling
setContentMeasuredWidthandsetWrapperMeasuredHeightsynchronously schedules immediate re-renders during the commit phase. Across recycled rows inExpenseReportListItemRowWideandAvatarTooltipsProvider, these synchronous layout updates cause parent list containers to re-measure, triggering further cell updates and immediate remounts. React detects over 50 nested commits within the same cycle and throwsError: Maximum update depth exceeded.What changes do you think we should make in order to solve the problem?
Unmount Inactive Hidden Tooltips in
GenericTooltip.tsx:In
src/components/Tooltip/GenericTooltip.tsx:setIsRendered(false)once the hide animation completes (or immediately inhideTooltipif animations are bypassed).BaseGenericTooltipwhile the tooltip is visible or animating:This ensures that recycled FlashList rows do not mount hidden
BaseGenericTooltipinstances or execute measurement layout effects when the user is simply scrolling.Add Equality Guards to Layout State Updates in
BaseGenericTooltip/index.tsx:In
src/components/Tooltip/BaseGenericTooltip/index.tsx:78-79, prevent unnecessary state dispatch if measurements haven't changed:What alternative solutions did you explore? (Optional)
useLayoutEffecttouseEffect:While moving state updates to
useEffectavoids the synchronous depth crash, it causes noticeable visual layout flicker because tooltips render at 0/default bounds before repainting at their measured size. ResettingisRenderedon hidden tooltips is the proper architectural solution.keyonBaseGenericTooltip:Removing the key avoids full component unmounts, but risks retaining stale content measurements when text length changes significantly. Unmounting hidden tooltips and equality-guarding measurement updates provides both safety and measurement accuracy.
What automated tests can you add to prevent this from re-occurring?
In
tests/unit/GenericTooltipTest.tsx:Verify that calling
hideTooltip()unmountsBaseGenericTooltipso that subsequent prop/text changes on the parent row do not triggeruseLayoutEffector measurement state updates.Simulate rapid
textprop updates on a mountedGenericTooltipcontainer and assert that state transitions settle cleanly without exceeding React's maximum update depth.Contributor details
Your Expensify account email: lkevinjosh10@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374
ayolyn commentedon Nov 3, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On web, scrolling or interacting with Search expense report rows (or list views rendering tooltips in recycled rows) crashes the app with a fatal React error:
Error: Maximum update depth exceeded (React #185)originating fromBaseGenericTooltip'suseLayoutEffectmeasurement updates.What is the root cause of that problem?
The issue stems from a combination of retained lazy-render state in
GenericTooltip, key-based unmounting/remounting on recycled list rows, and synchronous state updates inuseLayoutEffect:isRenderedon hidden tooltips:In
src/components/Tooltip/GenericTooltip.tsx:95-97,showTooltipsetssetIsRendered(true)andsetIsVisible(true). When the mouse leaves the cell,hideTooltip(lines 146-158) setssetIsVisible(false)and scales the tooltip to 0, butisRenderedpermanently remainstrue.In
GenericTooltip.tsx:203:textprop). BecauseisRenderedis stilltrue, the changed key forces React to completely unmount and remountBaseGenericTooltipfor hidden (closed) tooltips.BaseGenericTooltip:On every remount of
BaseGenericTooltip(src/components/Tooltip/BaseGenericTooltip/index.tsx:69-83),useLayoutEffectruns synchronously:setStateunconditionally insideuseLayoutEffecttriggers an immediate commit and re-render during layout phase. When FlashList recycles multiple rows during scrolling or container resize, mounting and measuring dozens of hidden tooltips in synchronous layout effects causes cascading re-renders that exceed React's 50-update nested depth limit, crashing the app into the error boundary.What changes do you think we should make in order to solve the problem?
1. Unmount hidden tooltips on content/key change in
src/components/Tooltip/GenericTooltip.tsx:When
isVisibleisfalse(the tooltip is closed/hidden) and the row is recycled or its text changes (prevText !== text), resetisRenderedtofalse:isVisibleistrue, so this effect does nothing.isRenderedbecomesfalse.BaseGenericTooltipis cleanly unmounted, completely eliminating hidden tooltip measurement and layout effects during list scrolling.showTooltip()setssetIsRendered(true)andsetIsVisible(true), mounting and measuring fresh dimensions accurately.2. Add equality guards to measurement updates in
src/components/Tooltip/BaseGenericTooltip/index.tsx:In
useLayoutEffect(src/components/Tooltip/BaseGenericTooltip/index.tsx:78-79), ensure state is only dispatched if the measured dimensions actually differ from current state:What alternative solutions did you explore? (Optional)
BaseGenericTooltiponly whileisVisibleis true ({shouldRender && isRendered && isVisible && <BaseGenericTooltip />}):Explored, but rejected because this immediately unmounts the component on mouse leave, abruptly cutting off the fade-out/scale-down animation and causing visual flickering. Resetting
isRenderedonly when!isVisibleAND content changes (prevText !== text) allows the exit animation to complete smoothly while guaranteeing that recycled rows never measure inactive tooltips.useLayoutEffecttouseEffectinBaseGenericTooltip:Rejected because moving initial measurement to
useEffectintroduces visible layout shift/flickering as tooltips render with undefined dimensions on the initial paint before snapping into place.What automated tests can you add to prevent this from re-occurring?
In
tests/unit/GenericTooltipTest.tsx:GenericTooltipwith initial text"Item A". CallshowTooltip()and thenhideTooltip(). Change thetextprop to"Item B"whileisVisibleisfalse. Verify thatBaseGenericTooltipis not mounted.showTooltip(). Verify thatBaseGenericTooltipmounts and renders with"Item B".Contributor details
Your Expensify account email: juliusayolyn@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0105126232377c4c5c
17 remaining items
melvin-bot commentedon Nov 7, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @gijoe0295 (
External)TassioSales commentedon Nov 8, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
In Search expense report rows, hover interactions and tooltip layout calculations cause an infinite render loop, crashing the web app with
Error: Maximum update depth exceededinBaseGenericTooltip.What is the root cause of that problem?
In
BaseGenericTooltip/index.tsx:onLayoutor hover events,updateTargetBoundscallssetTargetBounds(newBounds)on every layout pass.onLayoutagain with newly generated object references (even when coordinates have not changed), creating an infinite setState loop.What changes do you think we should make in order to solve the problem?
BaseGenericTooltip/index.tsx:x,y,width,height) before updatingtargetBoundsstate. If coordinates are identical within a sub-pixel threshold, do not invokesetTargetBounds.useCallbackand debounce measurement calls during rapid hover transitions.What alternative solutions did you explore? (Optional)
Using CSS-only tooltips for search rows, but maintaining
BaseGenericTooltippreserves accessibility attributes and consistent tooltip styling across all platforms.mountiny commentedon Nov 8, 2026
@gijoe0295 can you please review the proposals?
gijoe0295 commentedon Nov 8, 2026
Yes
melvin-bot commentedon Nov 11, 2026
@gijoe0295 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
TassioSales commentedon Nov 12, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
In the Search expense report view (
ExpenseReportListItemRowWide), rendering cells with tooltips (DateCell,TotalCell, etc.) can enter an infinite React render/layout loop throwingError: Maximum update depth exceeded (React #185)inBaseGenericTooltip.What is the root cause of that problem?
In
TextWithTooltip/index.tsx, text truncation is measured inonLayoutby checking whetherscrollWidth > offsetWidthorscrollHeight > offsetHeight, which conditionally triggerssetShowTooltip(true).When
showTooltipbecomes true,Tooltip/index.tsxconditionally switches from returningchildrendirectly to wrapping them in<BaseTooltip {...props}>{children}</BaseTooltip>.<BaseTooltip>wrapschildreninside<BoundsObserver>and<Hoverable>(a View container).This change in DOM/parent hierarchy alters the bounding box and flex styling around the inner
<Text>, which immediately dispatches anotheronLayoutevent. In table rows where column widths sit right at the boundary threshold, the wrapped layout evaluatesscrollWidth <= offsetWidth, causingsetShowTooltip(false).When
showTooltipbecomes false,Tooltip/index.tsxunmounts<BaseTooltip>, removing the wrapper and returningchildrendirectly. This unmounting triggers yet anotheronLayoutevent on<Text>, re-evaluatingscrollWidth > offsetWidthand callingsetShowTooltip(true)again.Each remount of
BaseGenericTooltiprunsuseLayoutEffect, which callssetContentMeasuredWidthandsetWrapperMeasuredHeightsynchronously during the commit phase. Because this mount/unmount cycle repeats on every layout event without settling, React rapidly hits its recursive update threshold and crashes withMaximum update depth exceeded.What changes do you think we should make in order to solve the problem?
src/components/Tooltip/types.tsandsrc/components/Tooltip/BaseTooltip/index.tsx:shouldRendertoSharedTooltipProps/TooltipPropsand pass it down to<GenericTooltip shouldRender={shouldRender} {...props}>.src/components/Tooltip/index.tsxto always render<BaseTooltip shouldRender={shouldRender} {...props}>{children}</BaseTooltip>rather than unmounting the wrapper tree whenshouldRenderis false.GenericTooltipalready handlesshouldRendernatively to determine whether the tooltip bubble/overlay should be rendered (hasTooltipContent && shouldRender && isRendered), allowing the child element's DOM wrapper hierarchy to remain completely stable across truncation checks.src/components/TextWithTooltip/index.tsx:onLayout, guard the state setter with an identity check: only callsetShowTooltipwhen the computed truncation state differs from previous state:setShowTooltip((prev) => (prev !== isTruncated ? isTruncated : prev)).scrollWidth - offsetWidth > 1) to eliminate subpixel rounding jitter on browser fractional zooms and responsive resize.What alternative solutions did you explore? (Optional)
keyresets inGenericTooltip: this causes remounting of tooltips rather than preventing the layout feedback oscillation.useEffectinstead ofuseLayoutEffectinBaseGenericTooltip: this causes visible positioning flicker on web when the tooltip first appears.What automated tests can you add to prevent this from re-occurring?
In
tests/unit/components/TooltipStableRenderTest.tsx, add a unit test that rendersTooltipwith a monitored child component, togglesshouldRenderbetweenfalseandtruemultiple times, and verifies that the child component maintains a stable mount count of 1 without remounting or causing recursive update cycles.Contributor details
Your Expensify account email: tassiolucian.ljs@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0179cdc82689f205c7
melvin-bot commentedon Nov 12, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
samithreddychinni commentedon Nov 12, 2026
@gijoe0295 are you planning to add the Help Wanted label? i reproduced the crash, traced the update loop, and prepared a tested fix. if contributions are open, i can submit the proposal.
gijoe0295 commentedon Nov 12, 2026
I'm working on it