You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and here goes the third time https://github.com/Rebilly/ReDoc/blob/8f7fccc6576c43518c13c4a95ca52302ab544542/src/services/AppStore.ts#L70
The UI components that are using extensionsHook function (f.e. <ApiHeader/>) are getting options exactly from this normalization invoke, but the theme.extensionsHook property is already set to undefined in the second invoke of the RedocNormalizedOptions for the loader, so this condition raw.theme && raw.theme.extensionsHook will return false and resulting options object provided in the store prop in <Redoc> will always contain property theme.extensionsHook being set to undefined
The text was updated successfully, but these errors were encountered:
Hi
I was trying to use
extensionsHook
function intheme
object but it never was invoked.I figured out the reason.
The main problem in this piece of code
https://github.com/Rebilly/ReDoc/blob/8f7fccc6576c43518c13c4a95ca52302ab544542/src/services/RedocNormalizedOptions.ts#L131-L136
RedocNormalizedOptions is invoked three times
https://github.com/Rebilly/ReDoc/blob/fec4605115d20f92de808ade4b9ead069f198c08/src/components/OptionsProvider.ts#L5
I suppose it's some default initialisation
https://github.com/Rebilly/ReDoc/blob/fec4605115d20f92de808ade4b9ead069f198c08/src/components/RedocStandalone.tsx#L43-L52
And that’s the heart of the matter. All context providing components are initialized inside
<Redoc />
component and you don't have the needed theme information for the loader. So you do the individual invoke of theRedocNormalizedOptions
here to get the info for the<Loading/>
component.During that invoke this magic line does it's trick
https://github.com/Rebilly/ReDoc/blob/8f7fccc6576c43518c13c4a95ca52302ab544542/src/services/RedocNormalizedOptions.ts#L133
It overrides original
options
object provided in the props of the<RedocStandalone/>
!!!https://github.com/Rebilly/ReDoc/blob/8f7fccc6576c43518c13c4a95ca52302ab544542/src/services/AppStore.ts#L70
The UI components that are using
extensionsHook
function (f.e.<ApiHeader/>
) are gettingoptions
exactly from this normalization invoke, but thetheme.extensionsHook
property is already set toundefined
in the second invoke of theRedocNormalizedOptions
for the loader, so this conditionraw.theme && raw.theme.extensionsHook
will return false and resultingoptions
object provided in thestore
prop in<Redoc>
will always contain propertytheme.extensionsHook
being set toundefined
The text was updated successfully, but these errors were encountered: