Skip to content
This repository was archived by the owner on Jan 19, 2024. It is now read-only.

Add app ID to state #4

Merged
merged 8 commits into from
Apr 14, 2022
Merged

Add app ID to state #4

merged 8 commits into from
Apr 14, 2022

Conversation

Cloud11PL
Copy link
Member

@Cloud11PL Cloud11PL commented Apr 12, 2022

@github-actions
Copy link

github-actions bot commented Apr 12, 2022

size-limit report 📦

Path Size
dist/app-bridge.cjs.production.min.js 6.42 KB (+0.48% 🔺)
dist/app-bridge.esm.js 3.73 KB (+0.72% 🔺)

@Cloud11PL Cloud11PL force-pushed the SALEOR-6434-add-app-id-to-state branch 5 times, most recently from aaf241e to 52db21a Compare April 13, 2022 09:38
@Cloud11PL Cloud11PL force-pushed the SALEOR-6434-add-app-id-to-state branch from 52db21a to b713fa6 Compare April 13, 2022 12:16
@Cloud11PL Cloud11PL force-pushed the SALEOR-6434-add-app-id-to-state branch from e018fd8 to 42a2617 Compare April 13, 2022 14:22
@Cloud11PL Cloud11PL force-pushed the SALEOR-6434-add-app-id-to-state branch from 7ec8458 to d4c0483 Compare April 13, 2022 15:02
@Cloud11PL Cloud11PL requested review from jwm0 and bmigirl April 14, 2022 08:05
@Cloud11PL Cloud11PL marked this pull request as ready for review April 14, 2022 08:07
src/index.ts Outdated
@@ -12,7 +12,9 @@ export function createApp(targetDomain?: string) {
domain = url.searchParams.get("domain") || "";
}

app.setState({ domain });
id = new URL(domain).searchParams.get("id") ?? "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick but it's not changed anywhere

Suggested change
id = new URL(domain).searchParams.get("id") ?? "";
const id = new URL(domain).searchParams.get("id") ?? "";

import createApp from ".";
import { AppBridgeState } from "./app";

export type App = ReturnType<typeof createApp>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of this, explicitly typing return type by function createApp(): Type is making breaking api harder. Now it's possible to change function signature and no one will know until consumers start complaining about breaking changes.

@Cloud11PL Cloud11PL merged commit 38254ec into main Apr 14, 2022
@Cloud11PL Cloud11PL deleted the SALEOR-6434-add-app-id-to-state branch April 14, 2022 11:53
@@ -10,7 +10,7 @@ Object.defineProperty(window.document, "referrer", {
import { actions, DispatchResponseEvent, createApp } from "../src";

describe("createApp", () => {
const domain = "test-domain";
const domain = "http://test-domain.com/?id=appid";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in dashboard we have shop.domain.host passed here, isn't that just a domain (without schema)? also as you pass src={urlJoin(src, `?domain=${shop.domain.host}&id=${appId}`)} in dashboard, should that be test-domain.com&id=appid here?

@@ -12,7 +12,9 @@ export function createApp(targetDomain?: string) {
domain = url.searchParams.get("domain") || "";
}

app.setState({ domain });
const id = new URL(domain).searchParams.get("id") ?? "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of that should we have id = url.searchParams.get("id") in else clause above?

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

Successfully merging this pull request may close these issues.

4 participants