File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,13 +12,22 @@ const ModelWrapper = createOnlyOAS31ComponentWrapper(
1212 const { getComponent, fn, getConfigs } = system
1313 const configs = getConfigs ( )
1414
15+ const pathname = window ?. location ?. pathname ?? "/"
16+
17+ if (
18+ ModelWrapper . ModelWithJSONSchemaContext &&
19+ ModelWrapper . pathname === pathname
20+ ) {
21+ return < ModelWrapper . ModelWithJSONSchemaContext { ...props } />
22+ }
23+
1524 const Model = getComponent ( "OAS31Model" )
1625 const withJSONSchemaSystemContext = getComponent (
1726 "withJSONSchema202012SystemContext"
1827 )
1928
2029 // we cache the HOC as recreating it with every re-render is quite expensive
21- ModelWrapper . ModelWithJSONSchemaContext ?? = withJSONSchemaSystemContext (
30+ ModelWrapper . ModelWithJSONSchemaContext = withJSONSchemaSystemContext (
2231 Model ,
2332 {
2433 config : {
@@ -36,9 +45,13 @@ const ModelWrapper = createOnlyOAS31ComponentWrapper(
3645 } ,
3746 }
3847 )
48+ ModelWrapper . pathname = pathname
3949
4050 return < ModelWrapper . ModelWithJSONSchemaContext { ...props } />
4151 }
4252)
4353
54+ ModelWrapper . ModelWithJSONSchemaContext = null
55+ ModelWrapper . pathname = null
56+
4457export default ModelWrapper
Original file line number Diff line number Diff line change @@ -10,7 +10,12 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
1010 const { getComponent, fn, getConfigs } = getSystem ( )
1111 const configs = getConfigs ( )
1212
13- if ( ModelsWrapper . ModelsWithJSONSchemaContext ) {
13+ const pathname = window ?. location ?. pathname ?? "/"
14+
15+ if (
16+ ModelsWrapper . ModelsWithJSONSchemaContext &&
17+ ModelsWrapper . pathname === pathname
18+ ) {
1419 return < ModelsWrapper . ModelsWithJSONSchemaContext />
1520 }
1621
@@ -20,7 +25,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
2025 )
2126
2227 // we cache the HOC as recreating it with every re-render is quite expensive
23- ModelsWrapper . ModelsWithJSONSchemaContext ?? = withJSONSchemaSystemContext (
28+ ModelsWrapper . ModelsWithJSONSchemaContext = withJSONSchemaSystemContext (
2429 Models ,
2530 {
2631 config : {
@@ -38,10 +43,12 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
3843 } ,
3944 }
4045 )
46+ ModelsWrapper . pathname = pathname
4147
4248 return < ModelsWrapper . ModelsWithJSONSchemaContext />
4349} )
4450
4551ModelsWrapper . ModelsWithJSONSchemaContext = null
52+ ModelsWrapper . pathname = null
4653
4754export default ModelsWrapper
Original file line number Diff line number Diff line change @@ -12,13 +12,22 @@ const ModelWrapper = createOnlyOAS32ComponentWrapper(
1212 const { getComponent, fn, getConfigs } = system
1313 const configs = getConfigs ( )
1414
15+ const pathname = window ?. location ?. pathname ?? "/"
16+
17+ if (
18+ ModelWrapper . ModelWithJSONSchemaContext &&
19+ ModelWrapper . pathname === pathname
20+ ) {
21+ return < ModelWrapper . ModelWithJSONSchemaContext { ...props } />
22+ }
23+
1524 const Model = getComponent ( "OAS31Model" )
1625 const withJSONSchemaSystemContext = getComponent (
1726 "withJSONSchema202012SystemContext"
1827 )
1928
2029 // we cache the HOC as recreating it with every re-render is quite expensive
21- ModelWrapper . ModelWithJSONSchemaContext ?? = withJSONSchemaSystemContext (
30+ ModelWrapper . ModelWithJSONSchemaContext = withJSONSchemaSystemContext (
2231 Model ,
2332 {
2433 config : {
@@ -36,9 +45,13 @@ const ModelWrapper = createOnlyOAS32ComponentWrapper(
3645 } ,
3746 }
3847 )
48+ ModelWrapper . pathname = pathname
3949
4050 return < ModelWrapper . ModelWithJSONSchemaContext { ...props } />
4151 }
4252)
4353
54+ ModelWrapper . ModelWithJSONSchemaContext = null
55+ ModelWrapper . pathname = null
56+
4457export default ModelWrapper
Original file line number Diff line number Diff line change @@ -10,7 +10,12 @@ const ModelsWrapper = createOnlyOAS32ComponentWrapper(({ getSystem }) => {
1010 const { getComponent, fn, getConfigs } = getSystem ( )
1111 const configs = getConfigs ( )
1212
13- if ( ModelsWrapper . ModelsWithJSONSchemaContext ) {
13+ const pathname = window ?. location ?. pathname ?? "/"
14+
15+ if (
16+ ModelsWrapper . ModelsWithJSONSchemaContext &&
17+ ModelsWrapper . pathname === pathname
18+ ) {
1419 return < ModelsWrapper . ModelsWithJSONSchemaContext />
1520 }
1621
@@ -20,7 +25,7 @@ const ModelsWrapper = createOnlyOAS32ComponentWrapper(({ getSystem }) => {
2025 )
2126
2227 // we cache the HOC as recreating it with every re-render is quite expensive
23- ModelsWrapper . ModelsWithJSONSchemaContext ?? = withJSONSchemaSystemContext (
28+ ModelsWrapper . ModelsWithJSONSchemaContext = withJSONSchemaSystemContext (
2429 Models ,
2530 {
2631 config : {
@@ -38,10 +43,12 @@ const ModelsWrapper = createOnlyOAS32ComponentWrapper(({ getSystem }) => {
3843 } ,
3944 }
4045 )
46+ ModelsWrapper . pathname = pathname
4147
4248 return < ModelsWrapper . ModelsWithJSONSchemaContext />
4349} )
4450
4551ModelsWrapper . ModelsWithJSONSchemaContext = null
52+ ModelsWrapper . pathname = null
4653
4754export default ModelsWrapper
You can’t perform that action at this time.
0 commit comments