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

Have an option to disable Redoc URL hash or to add a preffix to it #447

Open
protetore opened this issue Mar 30, 2018 · 6 comments
Open

Comments

@protetore
Copy link

We've been using ReDoc for some time, but now we have a requirement to embedded it inside one of our applications, but this application uses HashRouter, so when we access ReDoc, it's rewriting the URL removing the existing hash, which leads to an unknown route.

Example: http://localhost/#/docs/ gets rewritten to http://localhost/#/paths/~1something~1/get.

It would be nice to have an option to disable ReDoc URL hash and, maybe, an option to add a URL hash prefix, to be added between the hash (#) and the ReDoc path ( http://localhost/#/docs/paths/~1something~1/get).

@alairock
Copy link
Contributor

Any updates or thoughts on this one? plz/thanks

@brooksyd2
Copy link

Would also like to know if this is possible, particularly being able to prevent the hashing completely as this causes a lot of jumping around which is irritating.

@luisfarzati
Copy link

luisfarzati commented Nov 20, 2019

My workaround was to do patch MenuStore like this:

import { RedocStandalone, MenuStore } from "redoc";

MenuStore.prototype.subscribe = function() {
  // this._unsubscribe = this.scroll.subscribe(this.updateOnScroll);
  this._hashUnsubscribe = this.history.subscribe(this.updateOnHistory);
};

I'm using BrowserRouter and the hash change was triggering a re-render everytime, so scrolling down the page would take me all the way to the top again, rendering the page unusable.

@ssharma-sumo
Copy link

any update on this ??

@jrub
Copy link
Contributor

jrub commented Mar 24, 2023

Is there a way to remove the tag fragments like #tag/ when using x-traitTag? 🙏

@gish
Copy link

gish commented Apr 12, 2023

My workaround was to do patch MenuStore like this:

import { RedocStandalone, MenuStore } from "redoc";

MenuStore.prototype.subscribe = function() {
  // this._unsubscribe = this.scroll.subscribe(this.updateOnScroll);
  this._hashUnsubscribe = this.history.subscribe(this.updateOnHistory);
};

I'm using BrowserRouter and the hash change was triggering a re-render everytime, so scrolling down the page would take me all the way to the top again, rendering the page unusable.

In TypeScript I had to do it this way, since the methods are private.

MenuStore.prototype.subscribe = () => {
  // Do nothing
};
MenuStore.prototype.dispose = () => {
  // Do nothing
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants