From 7258f196fd91e3bfab4df9dd948c8451f2e63990 Mon Sep 17 00:00:00 2001 From: Evan Jacobs Date: Sat, 20 Oct 2018 14:20:02 -0500 Subject: [PATCH] modify override getter slightly to handle forwardRef components forwardRef emits an object :eyeroll: should fix #221 --- index.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 00519d50..688d3ea0 100644 --- a/index.js +++ b/index.js @@ -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)); } @@ -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; } /**