Skip to content

Commit a3566e4

Browse files
authored
Removing uneeded stories found in testing (#6707)
* Removing uneeded stories found in testing * fix lint
1 parent 975bf1d commit a3566e4

File tree

6 files changed

+5
-91
lines changed

6 files changed

+5
-91
lines changed

packages/@react-spectrum/card/stories/GalleryCardView.stories.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
FalsyIds,
2525
FilteringGrid,
2626
IsLoadingHeightGrid,
27-
IsLoadingNoHeightGrid,
2827
LoadingMoreGrid,
2928
StaticCards,
3029
StaticCardViewStory
@@ -162,14 +161,6 @@ export const SelectedKeys: ControlledCardViewStory = {
162161
}
163162
};
164163

165-
export const IsLoadingNoHeightGallery: DynamicCardViewStory = {
166-
...IsLoadingNoHeightGrid,
167-
args: {
168-
...IsLoadingNoHeightGrid.args,
169-
layout: GalleryLayout
170-
}
171-
};
172-
173164
export const IsLoadingHeightGallery: DynamicCardViewStory = {
174165
...IsLoadingHeightGrid,
175166
args: {

packages/@react-spectrum/card/stories/GridCardView.stories.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,6 @@ export const NoCards: NoItemCardViewStory = {
159159
render: (args) => <NoItemCardView {...args} />
160160
};
161161

162-
export const IsLoadingNoHeightGrid: DynamicCardViewStory = {
163-
...NoCards,
164-
args: {...NoCards.args, width: '800px', loadingState: 'loading'},
165-
name: 'loadingState = loading, no height'
166-
};
167-
168162
export const IsLoadingHeightGrid: DynamicCardViewStory = {
169163
...NoCards,
170164
args: {...NoCards.args, width: '800px', height: '800px', loadingState: 'loading'},

packages/@react-spectrum/card/stories/WaterfallCardView.stories.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
FalsyIds,
2525
FilteringGrid,
2626
IsLoadingHeightGrid,
27-
IsLoadingNoHeightGrid,
2827
LoadingMoreGrid,
2928
StaticCards,
3029
StaticCardViewStory
@@ -160,14 +159,6 @@ export const SelectedKeys: ControlledCardViewStory = {
160159
}
161160
};
162161

163-
export const IsLoadingNoHeightWaterfall: DynamicCardViewStory = {
164-
...IsLoadingNoHeightGrid,
165-
args: {
166-
...IsLoadingNoHeightGrid.args,
167-
layout: WaterfallLayout
168-
}
169-
};
170-
171162
export const IsLoadingHeightWaterfall: DynamicCardViewStory = {
172163
...IsLoadingHeightGrid,
173164
args: {

packages/@react-spectrum/table/stories/Table.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,7 @@ function TableWithBreadcrumbs(props) {
15461546
</Breadcrumbs>
15471547
<TableView
15481548
width="400px"
1549+
height="300px"
15491550
aria-label="table"
15501551
{...props}
15511552
selectedKeys={selection}

packages/react-aria-components/src/Table.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,9 @@ export const TableBody = /*#__PURE__*/ createBranchComponent('tablebody', <T ext
942942

943943
let {rowGroupProps} = useTableRowGroup();
944944
let TBody = useElementType('tbody');
945+
946+
// TODO: TableBody doesn't support being the scrollable body of the table yet, to revisit if needed. Would need to
947+
// call useLoadMore here and walk up the DOM to the nearest scrollable element to set scrollRef
945948
return (
946949
<TBody
947950
{...mergeProps(filterDOMProps(props as any), rowGroupProps)}

packages/react-aria-components/stories/Table.stories.tsx

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {action} from '@storybook/addon-actions';
1414
import {Button, Cell, Checkbox, CheckboxProps, Collection, Column, ColumnProps, ColumnResizer, Dialog, DialogTrigger, DropIndicator, Heading, Menu, MenuTrigger, Modal, ModalOverlay, Popover, ResizableTableContainer, Row, Table, TableBody, TableHeader, UNSTABLE_TableLayout as TableLayout, useDragAndDrop, UNSTABLE_Virtualizer as Virtualizer} from 'react-aria-components';
1515
import {isTextDropItem} from 'react-aria';
1616
import {MyMenuItem} from './utils';
17-
import React, {RefObject, useMemo, useRef} from 'react';
17+
import React, {useMemo, useRef} from 'react';
1818
import styles from '../example/index.css';
1919
import {UNSTABLE_TableLoadingIndicator} from '../src/Table';
2020
import {useAsyncList, useListData} from 'react-stately';
@@ -610,72 +610,6 @@ export const OnLoadMoreTableStory = {
610610
name: 'onLoadMore table'
611611
};
612612

613-
// TODO: this doens't quite work because the table body isn't initially rendered thus the ref is scrollRef is undef
614-
// This could be remedied perhaps by moving the onLoadMore call to TableBody internally and passing down the scrollRef and other load props via context from body.
615-
// That would guarentee that the ref for the table body is defined at the time the hook renders. Stashed this change locally, to be discussed.
616-
// TODO: Depenedent on whether or not we need to support the TableBody being scrollable, or can get away with just having the table resize container or the table itself
617-
// be scrollable. The vertical scrollbar extending to the column and the table body outline disappearing when horizontally scrolled are some of the problems with this
618-
const OnLoadMoreTableBodyScroll = () => {
619-
let list = useAsyncList<Character>({
620-
async load({signal, cursor}) {
621-
if (cursor) {
622-
cursor = cursor.replace(/^http:\/\//i, 'https://');
623-
}
624-
625-
// Slow down load so progress circle can appear
626-
await new Promise(resolve => setTimeout(resolve, 4000));
627-
let res = await fetch(cursor || 'https://swapi.py4e.com/api/people/?search=', {signal});
628-
let json = await res.json();
629-
return {
630-
items: json.results,
631-
cursor: json.next
632-
};
633-
}
634-
});
635-
636-
let isLoading = list.loadingState === 'loading' || list.loadingState === 'loadingMore';
637-
let scrollRef = useRef<HTMLTableSectionElement>(null);
638-
let memoedLoadMoreProps = useMemo(() => ({
639-
isLoading: isLoading,
640-
onLoadMore: list.loadMore,
641-
items: list.items
642-
}), [isLoading, list.loadMore, list.items]);
643-
useLoadMore(memoedLoadMoreProps, scrollRef);
644-
645-
return (
646-
<Table aria-label="Load more table">
647-
<TableHeader style={{display: 'block'}}>
648-
<Column id="name" isRowHeader>Name</Column>
649-
<Column id="height">Height</Column>
650-
<Column id="mass">Mass</Column>
651-
<Column id="birth_year">Birth Year</Column>
652-
</TableHeader>
653-
<TableBody
654-
ref={scrollRef as RefObject<HTMLTableSectionElement>}
655-
style={{display: 'block', overflow: 'auto', maxHeight: 100}}
656-
renderEmptyState={() => renderEmptyLoader({isLoading: list.loadingState === 'loading'})}
657-
items={list.items}>
658-
<Collection items={list.items}>
659-
{(item) => (
660-
<Row id={item.name} style={{width: 'inherit', height: 'inherit'}}>
661-
<Cell>{item.name}</Cell>
662-
<Cell>{item.height}</Cell>
663-
<Cell>{item.mass}</Cell>
664-
<Cell>{item.birth_year}</Cell>
665-
</Row>
666-
)}
667-
</Collection>
668-
{list.loadingState === 'loadingMore' && <MyTableLoadingIndicator />}
669-
</TableBody>
670-
</Table>
671-
);
672-
};
673-
674-
export const OnLoadMoreTableStoryBodyScroll = {
675-
render: OnLoadMoreTableBodyScroll,
676-
name: 'onLoadMore table, scrollable body'
677-
};
678-
679613
export function VirtualizedTable() {
680614
let items: {id: number, foo: string, bar: string, baz: string}[] = [];
681615
for (let i = 0; i < 1000; i++) {

0 commit comments

Comments
 (0)