Skip to content

Commit 312b95b

Browse files
JordanDC2Jordan Christiansen
andauthored
fix: Summary Context Circular Dependency (#754)
* fix-summary-context-circular-dependency * react type import Co-authored-by: Jordan Christiansen <[email protected]>
1 parent 9d4b3e4 commit 312b95b

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

src/Footer/Cell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { SummaryContext } from './Summary';
2+
import SummaryContext from './SummaryContext';
33
import Cell from '../Cell';
44
import TableContext from '../context/TableContext';
55
import type { AlignType } from '../interface';

src/Footer/Summary.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
import * as React from 'react';
1+
import type * as React from 'react';
22
import Cell from './Cell';
33
import Row from './Row';
4-
import type { ColumnType, StickyOffsets } from '../interface';
5-
6-
type FlattenColumns<RecordType> = readonly (ColumnType<RecordType> & { scrollbar?: boolean })[];
7-
8-
export const SummaryContext = React.createContext<{
9-
stickyOffsets?: StickyOffsets;
10-
scrollColumnIndex?: number;
11-
flattenColumns?: FlattenColumns<any>;
12-
}>({});
134

145
export interface SummaryProps {
156
fixed?: boolean | 'top' | 'bottom';

src/Footer/SummaryContext.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as React from 'react';
2+
import type { ColumnType, StickyOffsets } from '../interface';
3+
4+
type FlattenColumns<RecordType> = readonly (ColumnType<RecordType> & { scrollbar?: boolean })[];
5+
6+
const SummaryContext = React.createContext<{
7+
stickyOffsets?: StickyOffsets;
8+
scrollColumnIndex?: number;
9+
flattenColumns?: FlattenColumns<any>;
10+
}>({});
11+
12+
export default SummaryContext;

src/Footer/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import TableContext from '../context/TableContext';
3-
import Summary, { SummaryContext } from './Summary';
3+
import Summary from './Summary';
4+
import SummaryContext from './SummaryContext';
45
import type { ColumnType, StickyOffsets } from '../interface';
56

67
type FlattenColumns<RecordType> = readonly (ColumnType<RecordType> & { scrollbar?: boolean })[];

0 commit comments

Comments
 (0)