Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useEffect, useId} from 'react';
import React, {useDeferredValue, useEffect, useId} from 'react';
import type {ReactNode, RefObject} from 'react';
import {View} from 'react-native';
import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
Expand Down Expand Up @@ -51,6 +51,7 @@ function EditableCell({children, editContent, popoverContent, isEditing, canEdit
const isEditable = isLargeScreenWidth && !shouldUseNarrowLayout;
const cellId = useId();
const {setIsEditingCell, setFocusedCellId} = useEditingCellActions();
const isInteractive = useDeferredValue(true, false);

useEffect(() => {
if (!isEditable || !isEditing) {
Expand Down Expand Up @@ -85,9 +86,11 @@ function EditableCell({children, editContent, popoverContent, isEditing, canEdit
);
}

// Transient non-editable state (loading, permissions pending): render the container for layout
// consistency but skip the pressable so the user cannot trigger edit mode.
if (!canEdit) {
// Render a layout-identical plain View when editing isn't permitted OR while the
// PressableWithFeedback tree is deferred. This avoids mounting the expensive
// Tooltip / Hoverable / BoundsObserver subtree during the initial skeleton render,
// unblocking the main thread so the network response can be processed sooner.
if (!canEdit || !isInteractive) {
return <View style={[styles.editableCell]}>{children}</View>;
Comment on lines +93 to 94

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep deferred cells from falling through to row press

On wide search rows these cells are nested inside TransactionListItemWide's row-level PressableWithFeedback, so while useDeferredValue(true, false) is still false this plain View has no handler to consume the click. A user who clicks a visible editable cell immediately after the row renders can therefore trigger the parent row press/select navigation instead of editing the cell until the deferred render commits, which is a regression from always mounting the inner pressable when canEdit is true.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is an acceptable tradeoff for the screen loading faster.

}

Expand Down
Loading