Skip to content

Commit 73eeb4e

Browse files
committed
fix: resolve undefined types to undefined, fixes #1324
1 parent da50985 commit 73eeb4e

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/reconciler/resolver.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,12 @@ export function resolveNotComponent(type) {
6868

6969
export const resolveSimpleType = type => resolveProxy(type) || resolveUtility(type) || type;
7070

71-
export const resolveType = (type, options = {}) =>
72-
resolveProxy(type) || resolveUtility(type) || resolveNotComponent(type) || resolveComponent(type, options) || type;
71+
export const resolveType = (type, options = {}) => {
72+
if (!type) {
73+
return type;
74+
}
75+
76+
return (
77+
resolveProxy(type) || resolveUtility(type) || resolveNotComponent(type) || resolveComponent(type, options) || type
78+
);
79+
};

test/reactHotLoader.test.js

+7
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ describe('reactHotLoader', () => {
4747
const DivProxy = OriginalReactMock.createElement.mock.calls[0][0];
4848
expect(DivProxy[PROXY_KEY]).toBeDefined();
4949
});
50+
51+
it('null case', () => {
52+
reactHotLoader.patch(ReactMock);
53+
const result = React.createElement(undefined);
54+
55+
expect(result.type).toBeUndefined();
56+
});
5057
});
5158

5259
describe('#createFactory', () => {

0 commit comments

Comments
 (0)