Skip to content

Commit

Permalink
modify override getter slightly to handle forwardRef components
Browse files Browse the repository at this point in the history
forwardRef emits an object :eyeroll:

should fix #221
  • Loading branch information
quantizor committed Oct 20, 2018
1 parent c3686ca commit 7258f19
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ const BLOCK_SYNTAXES = [
PARAGRAPH_R,
];

function isPlainObject(input) {
return typeof input === 'object' && input.constructor === Object;
}

function containsBlockSyntax(input) {
return BLOCK_SYNTAXES.some(r => r.test(input));
}
Expand Down Expand Up @@ -694,9 +698,12 @@ function get(src, path, fb) {

function getTag(tag, overrides) {
const override = get(overrides, tag);
return typeof override === 'function'
? override
: get(overrides, `${tag}.component`, tag);

if (!override) return tag;

return isPlainObject(override)
? get(overrides, `${tag}.component`, tag)
: override;
}

/**
Expand Down

0 comments on commit 7258f19

Please sign in to comment.