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

Refactor store fetch, remove dead code #5597

Open
wants to merge 1 commit into
base: ensure-dev-store-access
Choose a base branch
from

Conversation

gordonhirsch
Copy link
Contributor

@gordonhirsch gordonhirsch commented Apr 1, 2025

WHY are these changes introduced?

Refactors store fetching code and removes dead code to simplify future changes.

WHAT is this pull request doing?

fetchStoreByDomain is no longer used and is removed in this PR.

This also allows the developer platform client interface to be simplified. Its storeByDomain method can then return an OrganizationStore instead of a GraphQL result.

This change paves the way for changes to OrganizationStore that are not coupled to underlying GraphQL.

How to test your changes?

Unit tests are sufficient here. The entire PR stack can be tophatted using the instructions here.

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

gordonhirsch commented Apr 1, 2025

Copy link
Contributor

github-actions bot commented Apr 1, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
76.57% (-0.07% 🔻)
9403/12281
🟡 Branches
71.73% (-0.06% 🔻)
4608/6424
🟡 Functions
76.3% (-0.05% 🔻)
2443/3202
🟡 Lines
77.09% (-0.05% 🔻)
8890/11532
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / bundle.ts
78.57% 75% 80% 84.62%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / app.ts
87.5%
70.33% (-1.1% 🔻)
92.98% 90.21%
🟢
... / extension-instance.ts
84.52% (-0.6% 🔻)
80.16% (-2.38% 🔻)
92.45% 85.06%
🟢
... / flow_action.ts
90% (-10% 🔻)
100%
75% (-25% 🔻)
90% (-10% 🔻)
🟢
... / fetch.ts
83.33% (-1.11% 🔻)
83.33% (+8.33% 🔼)
75% (-2.78% 🔻)
83.87% (-1.13% 🔻)
🟢
... / dev-session.ts
81.45% (-0.99% 🔻)
64.52%
90% (-0.63% 🔻)
83.78% (-0.96% 🔻)
🟢
... / serialize-fields.ts
95% (-2.5% 🔻)
87.5% (-3.13% 🔻)
100% 97.44%
🔴
... / partners-client.ts
25.49% (-0.17% 🔻)
31.58% 16.67%
25.17% (-0.17% 🔻)
🔴
... / partners.ts
58.62% (-12.21% 🔻)
50% (-25% 🔻)
57.14%
57.14% (-12.42% 🔻)

Test suite run success

2173 tests passing in 953 suites.

Report generated by 🧪jest coverage report action from 4b88cc9

@gordonhirsch gordonhirsch changed the title refactor store fetch, remove dead code Refactor store fetch, remove dead code Apr 1, 2025
@gordonhirsch gordonhirsch marked this pull request as ready for review April 1, 2025 22:31
@gordonhirsch gordonhirsch requested a review from a team as a code owner April 1, 2025 22:31
Copy link
Contributor

github-actions bot commented Apr 1, 2025

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

@@ -1432,7 +1432,7 @@ export function testDeveloperPlatformClient(stubs: Partial<DeveloperPlatformClie
Promise.resolve({organization: testOrganization(), apps: [testOrganizationApp()], hasMorePages: false}),
createApp: (_organization: Organization, _options: CreateAppOptions) => Promise.resolve(testOrganizationApp()),
devStoresForOrg: (_organizationId: string) => Promise.resolve({stores: [], hasMorePages: false}),
storeByDomain: (_orgId: string, _shopDomain: string) => Promise.resolve({organizations: {nodes: []}}),
storeByDomain: (_orgId: string, _shopDomain: string) => Promise.resolve(undefined),
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason we are explicitly passing undefined?

Suggested change
storeByDomain: (_orgId: string, _shopDomain: string) => Promise.resolve(undefined),
storeByDomain: (_orgId: string, _shopDomain: string) => Promise.resolve(),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, thanks for catching this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apparently it needs to be undefined . The suggested change causes this error:

Type '(_orgId: string, _shopDomain: string) => Promise<void>' is not assignable to type '(orgId: string, shopDomain: string) => Promise<OrganizationStore | undefined>'.
  Type 'Promise<void>' is not assignable to type 'Promise<OrganizationStore | undefined>'.
    Type 'void' is not assignable to type 'OrganizationStore | undefined'.ts(2322)

@gordonhirsch gordonhirsch force-pushed the ensure-dev-store-access branch from 4396abf to fd5b2a9 Compare April 4, 2025 18:26
@gordonhirsch gordonhirsch force-pushed the refactor-store-fetch branch from a2eab52 to 4b88cc9 Compare April 4, 2025 18:26
Copy link
Contributor

github-actions bot commented Apr 4, 2025

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/api/business-platform.d.ts
@@ -40,6 +40,6 @@ export declare function businessPlatformOrganizationsRequest<T>(query: string, t
  * @param variables - GraphQL variables to pass to the query.
  * @returns The response of the query of generic type <T>.
  */
-export declare function businessPlatformOrganizationsRequestDoc<TResult>(query: TypedDocumentNode<TResult, GraphQLVariables> | TypedDocumentNode<TResult, Exact<{
+export declare function businessPlatformOrganizationsRequestDoc<TResult, TVariables extends Variables>(query: TypedDocumentNode<TResult, TVariables> | TypedDocumentNode<TResult, Exact<{
     [key: string]: never;
-}>>, token: string, organizationId: string, variables?: GraphQLVariables): Promise<TResult>;
\ No newline at end of file
+}>>, token: string, organizationId: string, variables?: TVariables): Promise<TResult>;
\ No newline at end of file

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 this pull request may close these issues.

3 participants