Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"TypeError: Cannot read property 'shallowEqualKeys' of undefined" if loading a spec from localStorage #2099

Closed
hkosova opened this issue Jan 31, 2020 · 3 comments
Assignees

Comments

@hkosova
Copy link
Contributor

hkosova commented Jan 31, 2020

Q&A (please complete the following information)

  • OS: Windows 10
  • Browser: Chrome, Firefox, Edge latest
  • Method of installation: https://editor.swagger.io
  • Swagger-Editor version: 3.8.0
  • Swagger/OpenAPI version: OpenAPI 3.0

Describe the bug you're encountering

If you paste the spec provided below into Editor and then refresh the page, this causes many console errors, and schemas cannot be expanded in the UI.

Steps to reproduce

  1. Open an Incognito/Private window in your browser.
  2. Open the browser dev tools.
  3. Go to https://editor.swagger.io.
  4. Clear the default contents (Ctrl+A, Del), and paste the following spec:
openapi: 3.0.0
info:
  title: test
  version: 0.0.0
paths: {}
components:
  schemas:
    MySchema:
      type: string
      enum:
        - foo
        - bar

=> Note that UI is rendered correctly, and there are no errors in the browser console.
5. Refresh the editor page (F5).
6. Try to expand the schema in the UI.

Actual results

Schema cannot be expanded in the UI, and there are errors in the browser console:

TypeError: Cannot read property 'shallowEqualKeys' of undefined
    at t.value (components.jsx:24)
    at updateComponent (ReactCompositeComponent.js:625)
    at u.receiveComponent (ReactCompositeComponent.js:544)
    at Object.receiveComponent (ReactReconciler.js:122)
    at Object.updateChildren (ReactChildReconciler.js:107)
    at K._reconcilerUpdateChildren (ReactMultiChild.js:209)
    at K._updateChildren (ReactMultiChild.js:308)
    at K.updateChildren (ReactMultiChild.js:295)
    at K._updateDOMChildren (ReactDOMComponent.js:944)
    at K.updateComponent (ReactDOMComponent.js:758)

Expected results

No console errors. Schema can be expanded in the UI.

@char0n
Copy link
Member

char0n commented Nov 15, 2021

Working on fix by introducing top level Error Boundary that will simulate the behavior of v3.

@char0n
Copy link
Member

char0n commented Nov 26, 2021

[email protected] has been released yesterday, containing proper error handling using React Error Boundaries. Working on fix for Editor.

char0n added a commit to swagger-api/swagger-ui that referenced this issue Nov 26, 2021
char0n added a commit to swagger-api/swagger-ui that referenced this issue Nov 26, 2021
char0n added a commit that referenced this issue Nov 26, 2021
Main fix was introduced as part of [email protected].

Refs #2099
char0n added a commit that referenced this issue Nov 26, 2021
Main fix was introduced as part of [email protected].

Refs #2099
@char0n
Copy link
Member

char0n commented Nov 26, 2021

Fix released as [email protected]

@char0n char0n closed this as completed Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants