From a4a40135eca84caaef0a6993e8532bc814367e05 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 8 Oct 2018 11:54:07 +0300 Subject: [PATCH] fix: extensionHook not being used fixes #665 --- src/services/RedocNormalizedOptions.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/services/RedocNormalizedOptions.ts b/src/services/RedocNormalizedOptions.ts index 18623976..d445b667 100644 --- a/src/services/RedocNormalizedOptions.ts +++ b/src/services/RedocNormalizedOptions.ts @@ -126,14 +126,13 @@ export class RedocNormalizedOptions { allowedMdComponents: Dict; constructor(raw: RedocRawOptions, defaults: RedocRawOptions = {}) { - let hook; raw = { ...defaults, ...raw }; - if (raw.theme && raw.theme.extensionsHook) { - hook = raw.theme.extensionsHook; - raw.theme.extensionsHook = undefined; - } - this.theme = resolveTheme(mergeObjects({} as any, defaultTheme, raw.theme || {})); - this.theme.extensionsHook = hook; + const hook = raw.theme && raw.theme.extensionsHook; + this.theme = resolveTheme( + mergeObjects({} as any, defaultTheme, { ...raw.theme, extensionsHook: undefined }), + ); + + this.theme.extensionsHook = hook as any; this.scrollYOffset = RedocNormalizedOptions.normalizeScrollYOffset(raw.scrollYOffset); this.hideHostname = RedocNormalizedOptions.normalizeHideHostname(raw.hideHostname);