Skip to content

Commit

Permalink
Rename react-is SuspenseList exports to have unstable_ prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Feb 25, 2021
1 parent c4090d2 commit 73c472c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/react-is/index.experimental.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export {
Profiler,
StrictMode,
Suspense,
SuspenseList,
unstable_SuspenseList,
isAsyncMode,
isConcurrentMode,
isContextConsumer,
Expand All @@ -37,5 +37,5 @@ export {
isProfiler,
isStrictMode,
isSuspense,
isSuspenseList,
unstable_isSuspenseList,
} from './src/ReactIs';
4 changes: 2 additions & 2 deletions packages/react-is/src/ReactIs.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const Portal = REACT_PORTAL_TYPE;
export const Profiler = REACT_PROFILER_TYPE;
export const StrictMode = REACT_STRICT_MODE_TYPE;
export const Suspense = REACT_SUSPENSE_TYPE;
export const SuspenseList = REACT_SUSPENSE_LIST_TYPE;
export const unstable_SuspenseList = REACT_SUSPENSE_LIST_TYPE;

export {isValidElementType};

Expand Down Expand Up @@ -143,6 +143,6 @@ export function isStrictMode(object: any) {
export function isSuspense(object: any) {
return typeOf(object) === REACT_SUSPENSE_TYPE;
}
export function isSuspenseList(object: any) {
export function unstable_isSuspenseList(object: any) {
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
}
16 changes: 11 additions & 5 deletions packages/react-is/src/__tests__/ReactIs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,18 @@ describe('ReactIs', () => {
it('should identify suspense list', () => {
expect(ReactIs.isValidElementType(React.unstable_SuspenseList)).toBe(true);
expect(ReactIs.typeOf(<React.unstable_SuspenseList />)).toBe(
ReactIs.SuspenseList,
ReactIs.unstable_SuspenseList,
);
expect(ReactIs.isSuspenseList(<React.unstable_SuspenseList />)).toBe(true);
expect(ReactIs.isSuspenseList({type: ReactIs.SuspenseList})).toBe(false);
expect(ReactIs.isSuspenseList('React.SuspenseList')).toBe(false);
expect(ReactIs.isSuspenseList(<div />)).toBe(false);
expect(
ReactIs.unstable_isSuspenseList(<React.unstable_SuspenseList />),
).toBe(true);
expect(
ReactIs.unstable_isSuspenseList({type: ReactIs.unstable_SuspenseList}),
).toBe(false);
expect(ReactIs.unstable_isSuspenseList('React.unstable_SuspenseList')).toBe(
false,
);
expect(ReactIs.unstable_isSuspenseList(<div />)).toBe(false);
});

it('should identify profile root', () => {
Expand Down

0 comments on commit 73c472c

Please sign in to comment.