fix: Scrolling keeps rewriting url after a Redoc element was removed #2051 (#2085)

This commit is contained in:
Oprysk Vyacheslav 2022-07-19 18:17:28 +03:00 committed by GitHub
parent 7cc0500f3c
commit 0045be0b75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 14 deletions

13
package-lock.json generated
View File

@ -97,7 +97,6 @@
"ts-node": "^10.0.0",
"typescript": "~4.1.0",
"unfetch": "^4.2.0",
"url-polyfill": "^1.1.12",
"webpack": "^5.38.1",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^4.6.0",
@ -18028,12 +18027,6 @@
"querystring": "0.2.0"
}
},
"node_modules/url-polyfill": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/url-polyfill/-/url-polyfill-1.1.12.tgz",
"integrity": "sha512-mYFmBHCapZjtcNHW0MDq9967t+z4Dmg5CJ0KqysK3+ZbyoNOWQHksGCTWwDhxGXllkWlOc10Xfko6v4a3ucM6A==",
"dev": true
},
"node_modules/url-template": {
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz",
@ -32844,12 +32837,6 @@
}
}
},
"url-polyfill": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/url-polyfill/-/url-polyfill-1.1.12.tgz",
"integrity": "sha512-mYFmBHCapZjtcNHW0MDq9967t+z4Dmg5CJ0KqysK3+ZbyoNOWQHksGCTWwDhxGXllkWlOc10Xfko6v4a3ucM6A==",
"dev": true
},
"url-template": {
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz",

View File

@ -1,5 +1,5 @@
import * as React from 'react';
import { hydrate as hydrateComponent, render } from 'react-dom';
import { hydrate as hydrateComponent, render, unmountComponentAtNode } from 'react-dom';
import { configure } from 'mobx';
import { Redoc, RedocStandalone } from './components/';
@ -74,6 +74,12 @@ export function init(
);
}
export function destroy(element: Element | null = querySelector('redoc')): void {
if (element) {
unmountComponentAtNode(element);
}
}
export function hydrate(
state: StoreState,
element: Element | null = querySelector('redoc'),