magento / pwa-studio

šŸ› Development tools to build, optimize and deploy Progressive Web Applications for Magento 2.
https://developer.adobe.com/commerce/pwa-studio/
Open Software License 3.0
1.06k stars 682 forks source link

[Issue] Make Apollo links customizable #3847

Closed m2-assistant[bot] closed 2 years ago

m2-assistant[bot] commented 2 years ago

This issue is automatically created based on existing pull request: magento/pwa-studio#3842: Make Apollo links customizable


Description

Allow Apollo links to be customized by a configureLinks prop to Adapter / useAdapter. Also, while we're at it, extract the links into their own modules.

This can either follow #3757 or we can combine them here.

New component/talon signature

function configureLinks(linksMap) {
  // receive a map
  // return either a map or array, with modifications
  return Array.from(linksMap.values())
}

const tree = (
  <Adapter
    apiBase="https://example.com/graphql"
    configureLinks={configureLinks}
    store={store}
    styles={styles}
  />
)

New package structure

peregrine
|- lib
  |- Apollo
    |- links
      |- authLink.js
      |- errorLink.js
      |- gqlCacheLink.js
      |- index.js
      |- mutationQueueLink.js
      |- retryLink.js
      |- storeLink.js

Related Issue

CIF-2826

Acceptance

Verification Stakeholders

Specification

Verification Steps

Test scenario(s) for direct fix/feature

Test scenario(s) for any existing impacted features/areas

Test scenario(s) for any Magento Backend Supported Configurations

Is Browser/Device testing needed?

Any ad-hoc/edge case scenarios that need to be considered?

Screenshots / Screen Captures (if appropriate)

Breaking Changes (if any)

Checklist

anthoula commented 2 years ago

@magento export issue to JIRA project PWA as Story

github-jira-sync-bot commented 2 years ago

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/PWA-2828 is successfully created for this GitHub issue.