Skip to content

Commit

Permalink
Merge pull request #19975 from dannyhw/fix/patches-for-RN6
Browse files Browse the repository at this point in the history
fix: patch preview web and refs to not crash react native storybook
  • Loading branch information
shilman committed Nov 27, 2022
2 parents 2f9f0de + afd1a3e commit e5375c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/api/src/modules/refs.ts
Expand Up @@ -75,7 +75,7 @@ const findFilename = /(\/((?:[^\/]+?)\.[^\/]+?)|\/)$/;

export const getSourceType = (source: string, refId: string) => {
const { origin: localOrigin, pathname: localPathname } = location;
const { origin: sourceOrigin, pathname: sourcePathname } = new URL(source);
const { origin: sourceOrigin, pathname: sourcePathname } = new URL(source || location.origin);

const localFull = `${localOrigin + localPathname}`.replace(findFilename, '');
const sourceFull = `${sourceOrigin + sourcePathname}`.replace(findFilename, '');
Expand Down
6 changes: 3 additions & 3 deletions lib/preview-web/src/PreviewWeb.tsx
Expand Up @@ -58,11 +58,11 @@ export class PreviewWeb<TFramework extends AnyFramework> extends Preview<TFramew

currentRender: Render<TFramework>;

constructor() {
constructor(urlStore: UrlStore = new UrlStore(), webview: WebView = new WebView()) {
super();

this.view = new WebView();
this.urlStore = new UrlStore();
this.view = webview;
this.urlStore = urlStore;

// Add deprecated APIs for back-compat
// @ts-ignore
Expand Down

0 comments on commit e5375c6

Please sign in to comment.