Skip to content

Commit

Permalink
fix: resolve undefined types to undefined, fixes #1324
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Aug 27, 2019
1 parent da50985 commit 73eeb4e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/reconciler/resolver.js
Expand Up @@ -68,5 +68,12 @@ export function resolveNotComponent(type) {

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

export const resolveType = (type, options = {}) =>
resolveProxy(type) || resolveUtility(type) || resolveNotComponent(type) || resolveComponent(type, options) || type;
export const resolveType = (type, options = {}) => {
if (!type) {
return type;
}

return (
resolveProxy(type) || resolveUtility(type) || resolveNotComponent(type) || resolveComponent(type, options) || type
);
};
7 changes: 7 additions & 0 deletions test/reactHotLoader.test.js
Expand Up @@ -47,6 +47,13 @@ describe('reactHotLoader', () => {
const DivProxy = OriginalReactMock.createElement.mock.calls[0][0];
expect(DivProxy[PROXY_KEY]).toBeDefined();
});

it('null case', () => {
reactHotLoader.patch(ReactMock);
const result = React.createElement(undefined);

expect(result.type).toBeUndefined();
});
});

describe('#createFactory', () => {
Expand Down

0 comments on commit 73eeb4e

Please sign in to comment.