Skip to content

Commit 4cc3fd1

Browse files
os-zhuangclaude
andauthored
fix(grid): activate mobile card view at the 768px app breakpoint (#1822)
ObjectGrid already has a mobile card view (stacked cards instead of a side-scrolling table), but it only kicked in below 480px — narrower than the app's mobile breakpoint (768px, shared by useIsMobile / Tailwind md: / the responsive page + grid layout). The 480–768px band (most phones in landscape, tablet-portrait, and even some phones whose reported innerWidth sits just over 480) fell through to the wide table and had to be side-scrolled to read columns past the third. Raise the threshold to 768 so the card view covers the full mobile range, matching every other responsive switch in the shell. Desktop (>=768) is unchanged. Pairs with the iOS grouped-inset record detail (#1820): list cards now tap straight into the stacked detail with no h-scroll anywhere in the mobile flow. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ff4f0be commit 4cc3fd1

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packages/plugin-grid/src/ObjectGrid.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,10 @@ export const ObjectGrid: React.FC<ObjectGridProps> = ({
319319
enabled: !!dataSource && !!schema.objectName,
320320
});
321321

322+
// Activate the mobile card view below the 768px app mobile breakpoint so
323+
// phones and tablet-portrait never need to side-scroll a wide grid.
322324
useEffect(() => {
323-
const checkWidth = () => setUseCardView(window.innerWidth < 480);
325+
const checkWidth = () => setUseCardView(window.innerWidth < 768);
324326
checkWidth();
325327
window.addEventListener('resize', checkWidth);
326328
return () => window.removeEventListener('resize', checkWidth);
@@ -1629,7 +1631,9 @@ export const ObjectGrid: React.FC<ObjectGridProps> = ({
16291631
? `${schema.objectName.charAt(0).toUpperCase() + schema.objectName.slice(1)} Detail`
16301632
: 'Record Detail';
16311633

1632-
// Mobile card-view fallback for screens below 480px
1634+
// Mobile card-view: below the 768px app breakpoint (matches useIsMobile /
1635+
// Tailwind md: / the responsive page+grid layout), render stacked cards
1636+
// instead of a side-scrolling wide table.
16331637
if (useCardView && data.length > 0 && !isGrouped) {
16341638
const displayColumns = generateColumns().filter((c: any) => c.accessorKey !== '_actions');
16351639

0 commit comments

Comments
 (0)