wll8 / redoc-try

Add `Try it out` function like swagger on redoc.
https://wll8.github.io/redoc-try
117 stars 33 forks source link

Multiple Try it out buttons #5

Closed saadshaukat-hello closed 3 years ago

saadshaukat-hello commented 3 years ago

I get multiple try it out buttons instead of one. When clicked, receive the following error.

try.js?v=1:251 Uncaught TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'. at HTMLButtonElement. (try.js?v=1:251) at HTMLButtonElement.dispatch (VM12181 jquery.min.js:3) at HTMLButtonElement.q.handle (VM12181 jquery.min.js:3)

wll8 commented 3 years ago

Can you give me a code that can see the problem? Thank you.

Hope to tell me the following information:

In addition, you can try the uncompiled program https://cdn.jsdelivr.net/gh/wll8/redoc-try/try.js to get a clearer error location.

In addition, do you mean multiple buttons under one API?

akalineskou commented 3 years ago

I had the same issue, and it was because redoc suggests you initialize it using <redoc spec-url="url/doc.json"></redoc> but if you add the id redoc-container to that element, it will get initialized 2 times (thus the regex which finds the selector wont work)

If you just add <div id="redoc-container"></div> and delete <redoc> it works for me. This should be mentioned in the docs IMO since this library will initialize Redoc for you and not just iteself.

wll8 commented 3 years ago

Thank you for your feedback. I have added this hint in the readme. And released new features and tools, welcome to use.