Skip to content

fix(datagrid): redraw cell when editability changes (chevron flicker on save/refresh)#1214

Merged
datlechin merged 1 commit into
mainfrom
fix/datagrid-chevron-flicker
May 11, 2026
Merged

fix(datagrid): redraw cell when editability changes (chevron flicker on save/refresh)#1214
datlechin merged 1 commit into
mainfrom
fix/datagrid-chevron-flicker

Conversation

@datlechin
Copy link
Copy Markdown
Member

Summary

DataGridCellView.computeAccessoryRect gates the chevron accessory on isEditableCell for dropdown / boolean / date / JSON / blob cells:

```swift
case .dropdown, .boolean, .date, .json, .blob:
guard isEditableCell else { return .zero }
```

After #1212's performance pass, `configure` only marks the cell `needsDisplay = true` when a tracked property changed. `isEditableCell` was updated unconditionally:

```swift
isEditableCell = state.isEditable
```

…so when only the editability flipped (refresh, safe-mode toggle, view-to-table switch) with otherwise identical cell content, no redraw was scheduled and the chevron stuck in its stale state. User saw `audit_log.payload` (LONGTEXT with `json_valid` check, detected as JSON) chevron disappear after save / refresh / reopen.

Fix

Compare before assign and flag `needsRedraw` on change:

```swift
if isEditableCell != state.isEditable {
isEditableCell = state.isEditable
needsRedraw = true
}
```

Audited the rest of `configure`. Other unconditional assignments (`placeholder`, `isLargeDataset`) are write-only fields that aren't read elsewhere, so they can't affect drawing. `cellRow` / `cellColumnIndex` only feed accessibility. The two cells that do affect drawing (text/tint/visualState/kind/rawValue/focus) were already tracked.

Test plan

  • Open MySQL `tablepro_demo` → `audit_log`. `payload` column shows chevron on each cell.
  • Hit Refresh. Chevron stays visible.
  • Toggle Safe Mode (read-only). Chevrons disappear immediately.
  • Toggle Safe Mode back off. Chevrons reappear.
  • Open a view (e.g. `active_users`) then back to `audit_log`. Chevron state correct.
  • Same check on dropdown columns (`status` ENUM in `wide_events`) and date columns (`event_date`, `occurred_at`).

@datlechin datlechin merged commit ba28ce8 into main May 11, 2026
1 check passed
@datlechin datlechin deleted the fix/datagrid-chevron-flicker branch May 11, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant