Skip to content

swagger-ui-react: spec does not update on prop change and resets to default on page refresh  #9965

@glowcloud

Description

@glowcloud

Initial issue reported in swagger-api/swagger-editor#5075

When refreshing the page in Swagger Editor, the specification is not retained. When updating the spec prop, the update is also not reflected. This happens due to the changes to logic that came with the swagger-ui-react component refactor.

We need to keep previous props as references and change the spec update condition to:

if (
 spec &&
 spec !== SwaggerUIConstructor.config.defaults.spec &&
 (spec !== prevStateSpec || spec !== prevSpec)
)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions