Swagger-ui: "layoutSelectors is undefined" when displaying the model of a request

Created on 16 Aug 2020  路  8Comments  路  Source: swagger-api/swagger-ui

Q&A (please complete the following information)

  • OS: Windows
  • Browser: Chrome
  • Version: 84
  • Method of installation: local build
  • Swagger-UI version: 3.32.1
  • Swagger/OpenAPI version: Swagger 2.0

Content & configuration

Happens with any configuration

Describe the bug you're encountering

I was working on trying to fix a performance issue in Swagger when I noticed a console error unrelated to my changes. You can reproduce the error simply by clicking on the 'model' of a request.

image

To reproduce...

Steps to reproduce the behavior:

  1. Go to https://petstore.swagger.io/
  2. Click on '/pet Add a new pet' (2nd endpoint)
  3. Click on 'Model' in the Body parameter
  4. See error in console

Expected behavior

No error messages.

Screenshots

image

Additional context or thoughts

I have not been able to reproduce the issue with V3.31.1 so this error must have been introduced recently.

bug regression

Most helpful comment

The fix for this issue will be in this week's release.

All 8 comments

In Chrome, the error is:

Uncaught TypeError: Cannot read property 'getScrollToKey' of undefined
    at model-collapse.jsx:69
    at ReactRef.js:18
    at Object.o.attachRefs (ReactRef.js:40)
    at $.o (ReactReconciler.js:21)
    at e.notifyAll (CallbackQueue.js:74)
    at p.close (ReactReconcileTransaction.js:78)
    at p.closeAll (Transaction.js:207)
    at perform (Transaction.js:154)
    at y.perform (Transaction.js:141)
    at y.perform (ReactUpdates.js:87)

This issue also prevents nested models from being expanded.

Steps to reproduce:

  1. Open https://petstore.swagger.io.
  2. Open the browser dev toops > Console tab.
  3. Scroll down to the Models section.
  4. Expand the "Pet" model.
  5. Try to expand the photoUrls or tags subschemas, or the enum of the status property.

Expected results: Subschemas and enums are expanded.

Actual result: Subschemas and enums are NOT expanded.

I'm getting this error even after rebuilding the latest version of the docker image. Is the fix released already or I need to wait more? It's odd that the error prevents me from expanding only some object, while others work. It doesn't matter if they are new or old, seems just random.

In Chrome, the error is:

Uncaught TypeError: Cannot read property 'getScrollToKey' of undefined
    at model-collapse.jsx:69
    at ReactRef.js:18
    at Object.o.attachRefs (ReactRef.js:40)
    at $.o (ReactReconciler.js:21)
    at e.notifyAll (CallbackQueue.js:74)
    at p.close (ReactReconcileTransaction.js:78)
    at p.closeAll (Transaction.js:207)
    at perform (Transaction.js:154)
    at y.perform (Transaction.js:141)
    at y.perform (ReactUpdates.js:87)

This issue also prevents nested models from being expanded.

Steps to reproduce:

  1. Open https://petstore.swagger.io.
  2. Open the browser dev toops > Console tab.
  3. Scroll down to the Models section.
  4. Expand the "Pet" model.
  5. Try to expand the photoUrls or tags subschemas, or the enum of the status property.

Expected results: Subschemas and enums are expanded.

Actual result: Subschemas and enums are NOT expanded.

Do you have any solution for the moment?

@Stenfrank I'm also getting the error Uncaught TypeError: Cannot read property 'getScrollToKey' of undefined

The fix for this issue will be in this week's release.

Fixed in v. 3.32.2.

In Chrome, the error is:

Uncaught TypeError: Cannot read property 'getScrollToKey' of undefined
    at model-collapse.jsx:69
    at ReactRef.js:18
    at Object.o.attachRefs (ReactRef.js:40)
    at $.o (ReactReconciler.js:21)
    at e.notifyAll (CallbackQueue.js:74)
    at p.close (ReactReconcileTransaction.js:78)
    at p.closeAll (Transaction.js:207)
    at perform (Transaction.js:154)
    at y.perform (Transaction.js:141)
    at y.perform (ReactUpdates.js:87)

This issue also prevents nested models from being expanded.

Steps to reproduce:

  1. Open https://petstore.swagger.io.
  2. Open the browser dev toops > Console tab.
  3. Scroll down to the Models section.
  4. Expand the "Pet" model.
  5. Try to expand the photoUrls or tags subschemas, or the enum of the status property.

Expected results: Subschemas and enums are expanded.

Actual result: Subschemas and enums are NOT expanded.

Hi all,

Hi. I am still having this issue in swagger-ui-express. :(

@Kenan13 please open a new issue and fill in the requested information in the issue template.

Was this page helpful?
0 / 5 - 0 ratings