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

Product provider work #1397

Merged
merged 18 commits into from
Jun 7, 2022
Merged

Product provider work #1397

merged 18 commits into from
Jun 7, 2022

Conversation

frehner
Copy link
Contributor

@frehner frehner commented May 31, 2022

Description

Closes #1307

  • Updates useProductOptions to pull from context instead of creating its own state; a much better experience.
  • Removes ProductProvider
  • Updates ProductPrice to take in the product as a prop

Additional context

If you view the changes without whitespaces, the documentation updates will be a lot smaller, as I'm also removing edges { node { and replacing it with just nodes { which is much easier.


Before submitting the PR, please make sure you do the following:

  • Read the Contributing Guidelines
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123)
  • Update docs in this repository according to your change
  • Run yarn changeset add if this PR cause a version bump based on Keep a Changelog and adheres to Semantic Versioning

frehner added 3 commits May 26, 2022 10:03
I think I have the code all working, it's now just updating tests and stuff. I updated the docs but they probably need to be cleaned up more.
@frehner
Copy link
Contributor Author

frehner commented May 31, 2022

@mcvinci lots of doc changes here; I thought I would give you the heads up. No rush, as this PR isn't ready yet anyway, but I figured the sooner the better for you to look over?

Copy link
Contributor

@mcvinci mcvinci left a comment

Choose a reason for hiding this comment

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

Looking great, @frehner! Thanks so much! ❤️ I know this is still work-in-progress, so I've just made a first pass at the docs. I've got a corresponding draft shopify-dev PR open here with the generated docs as well: https://github.com/Shopify/shopify-dev/pull/20942.

If you want me to take a look again when we're in a more final state, feel free to ping me!

docs/components/product-variant/productoptionsprovider.md Outdated Show resolved Hide resolved
docs/components/product-variant/productprice.md Outdated Show resolved Hide resolved
docs/hooks/product-variant/useproductoptions.md Outdated Show resolved Hide resolved
docs/hooks/product-variant/useproductoptions.md Outdated Show resolved Hide resolved
docs/components/product-variant/productoptionsprovider.md Outdated Show resolved Hide resolved
docs/components/product-variant/productoptionsprovider.md Outdated Show resolved Hide resolved
docs/components/product-variant/productoptionsprovider.md Outdated Show resolved Hide resolved
@github-actions github-actions bot had a problem deploying to preview June 6, 2022 22:13 Failure
@github-actions github-actions bot had a problem deploying to preview June 6, 2022 22:15 Failure
@github-actions github-actions bot had a problem deploying to preview June 6, 2022 22:17 Failure
@github-actions github-actions bot had a problem deploying to preview June 6, 2022 22:18 Failure
data: product,
initialVariantId: explicitVariantId,
}: ProductOptionsProviderProps) {
// The flattened variants
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Code here is mostly a copy-paste from useProductOptions but now in a context!

* then the selected variant and options will reference incorrect
* values.
*/
useEffect(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed up how this useEffect worked; I'm not sure it worked like the comment said it should. This is a bit cleaner too

);
}

function getVariantBasedOnIdProp(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should help us follow the outline in the TS doc above

: {};
}

function isProductVariantArray(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To make TS happy

@@ -0,0 +1,229 @@
import {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

copy/paste from a different file, with minor changes

}
sellingPlanGroupsConnection?: SellingPlanGroupConnection;
}> & {
/** A callback to set the selected variant to the variant passed as an argument. */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These will never be null so take them out of the PartialDeep wrapper.

@frehner frehner marked this pull request as ready for review June 6, 2022 23:00
Copy link
Contributor

@mcvinci mcvinci left a comment

Choose a reason for hiding this comment

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

Docs updates look great! Thanks, @frehner! 💯

Copy link
Member

@benjaminsehl benjaminsehl left a comment

Choose a reason for hiding this comment

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

Awesome work — some of the more technical stuff I don't know enough to weigh in on, but already you can see this just getting so much cleaner.

Had a couple notes on queries that I'd love to see changed. Only really important to do it in the docs as we're already implementing the demo store changes.

  1. Cleaning up the Media query, 2. Metafields is now only available as explicitly called items, no array.

I think 2 is already on your list of things though, so no worries if you want to ignore here.

}
}
}
metafields(first: $numProductMetafields) {
Copy link
Member

Choose a reason for hiding this comment

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

Metafields as an array will need to be removed. Our API no longer supports 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.

Yup that work is coming up. This was just a copy/paste from previous file.

handle
id
media(first: $numProductMedia) {
nodes {
Copy link
Member

Choose a reason for hiding this comment

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

This query can be improved via … 

 fragment MediaFields on Media {
    mediaContentType
    alt
    previewImage {
      url
    }
    ... on MediaImage {
      id
      image {
        url
        width
        height
      }
    }
    ... on Video {
      id
      sources {
        mimeType
        url
      }
    }
    ... on Model3d {
      id
      sources {
        mimeType
        url
      }
    }
    ... on ExternalVideo {
      id
      embedUrl
      host
    }
  }

Sadly the id can't actually be pulled up to the top.

Copy link
Contributor

@jplhomer jplhomer left a comment

Choose a reason for hiding this comment

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

❤️ Thanks for the diligent work!

For my own knowledge, is it fair to say that the reason we're taking away the ability to use useProductOptions(data) as a standalone hook (without requiring a provider wrapper) is that it's very unlikely this hook would be used on its own in isolation? And by requiring a provider pattern, we're actually making it easier to use in real-world cases (like distributed components which manage options, selling plan allocations, etc)?

Also ✨ love the lack of edges in our queries.

@frehner
Copy link
Contributor Author

frehner commented Jun 7, 2022

For my own knowledge, is it fair to say that the reason we're taking away the ability to use useProductOptions(data) as a standalone hook (without requiring a provider wrapper) is that it's very unlikely this hook would be used on its own in isolation? And by requiring a provider pattern, we're actually making it easier to use in real-world cases (like distributed components which manage options, selling plan allocations, etc)?

Yup, that's exactly right; it didn't make sense to me that each useProductOptions() call would keep track of its own state and that if you wanted to share that state you would have to set up your own context provider or pass all the props down.

Also ✨ love the lack of edges in our queries.

I do too, but I'm also realizing that we'll probably have to keep flattenConnection() and use it everywhere so that our code can handle if the dev uses nodes or edges.node; I don't think it make sense to force a dev to use nodes if they need the pagination data from edges or something like that. That'll be a followup PR.

Copy link
Contributor

@blittle blittle left a comment

Choose a reason for hiding this comment

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

I did some local testing, directly switching from one product to another without going to another page first. The product options and variants all seemed to work properly. Great work, looks good to me!

@frehner frehner merged commit fbd185a into v1.x-2022-07 Jun 7, 2022
@frehner frehner deleted the product-provider-work branch June 7, 2022 20:45
@frehner
Copy link
Contributor Author

frehner commented Jun 7, 2022

We're going to merge and try to get this in this week's release.

@scottdixon
Copy link
Contributor

Hey @frehner! The demo-store no longer updates product image or price when a new variant is selected on the product page. Seems like selectedVariant value never changes? 🤔

@scottdixon
Copy link
Contributor

Also I think the edges work might not be compatible with flattenConnection.

Check the FeaturedProductsBox component on the demo-store index route.

image

lordofthecactus added a commit that referenced this pull request Jun 8, 2022
* Center logo in Demo Store header (#1378)

* Template favicons updated with SVGs, and moved to /src/assets (#1377)

* Automatically fix GQL imports in exisiting Hydrogen Projects (#1336)

* Add eslint rule to fix gql imports

* Update README.md

* add tests with fixer

* Update packages/eslint-plugin/src/rules/prefer-gql/README.md

Co-authored-by: Michelle Vinci <[email protected]>

* Apply suggestions from code review

Co-authored-by: Michelle Vinci <[email protected]>

* Final copy edits

Co-authored-by: Michelle Vinci <[email protected]>

* Remove CLI scripts (#1379)

* Support ESLint v8 in `eslint-plugin` (#1373)

* remove and reorganize duplicated content (#1380)

* Simplify `routes` property in Hydrogen config (#1313)

* Drop import.meta.globEager in dev

* Refactor variables and virtual modules

* Fix code after cherry-pick

* Extract Vitception

* Use Vitception to load routes during build

* Use static imports to fix build

* Add default routes path

* Fix types and paths

* Fix dirPrefix issues

* Fix HMR in route files

* Use default value for config.routes

* Fix issue in Node 16.15

* Extract virtual-files plugin for clarity

* Cleanup

* Fix unit tests

* Update docs

* Changeset

* Cleanup

* Regenerate broken graphql.schema.json

* Disable rules-of-hooks in server components

* Disable prefer-gql in test

* Apply suggestions from code review

Co-authored-by: Michelle Vinci <[email protected]>

* Revert "Disable prefer-gql in test"

This reverts commit d130f1c.

* Revert "Disable rules-of-hooks in server components"

This reverts commit e0ffbf6.

Co-authored-by: Michelle Vinci <[email protected]>

* Update formatting of release notes

* minor fixes (#1391)

* Remove hello world code (#1392)

* [ci] release v1.x-2022-07 (#1343)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Remove broken changesets

* [Hydrogen docs]: User authentication (#1353)

* initial draft

* remove useCustomer docs

* add address and order routes

* integrate feedback

* Make graphql-tag a dep instead of a devDep to fix dev errors (#1394)

* [ci] release v1.x-2022-07 (#1396)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* StackBlitz: turn off auto-save (#1386)

* Simplify renderHydrogen internal logic (#1384)

* Simplify entry-server code

* Combine stream and render into runSsr

* Rename some variables and functions for consistency

* Fix: write head before checking redirects in Node

* Remove unnecessary check and add comment

* These li'l babies need a flipperoo (#1398)

* Rename utility `isClient` to `isBrowser` (#1389)

* Rename utility `isClient` to `isBrowser`

* Switch to document check instead of window

* Apply suggestions from code review

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/utilities/isserver.md

Co-authored-by: Michelle Vinci <[email protected]>

Co-authored-by: Michelle Vinci <[email protected]>

* Fix unique key issue in old demo store template

* Workers support streaming now (#1227)

* I think streaming is supported now?

* Bump

* Add changeset

* style guide fixes (#1407)

* Move logger options to Hydrogen config (#1403)

* Stop using globalThis for logger and minor refactor

* Move logger options to Hydrogen config file

* Update unit tests

* Remove setLogger call from e2e tests

* Always call setLogger for HMR

* Remove unnecessary type

* Add docs

* Changeset

* Fix link

* Apply suggestions from code review

Co-authored-by: Michelle Vinci <[email protected]>

Co-authored-by: Michelle Vinci <[email protected]>

* Fix CountrySelector styling in demo store (#1415)

* fix-demo-store-country-selector-styling

* move conditional classes back to newline

* add changeset

* Fix logger title in docs (#1419)

* Fix logger title in docs

* Fix unrelated changeset

* Suppress confusing warnings (#1399)

* Supress confusing warnings

* Changeset

* Typo

* Improve component bundling and reduce total downloaded files (#1361)

* Skip module references for nested client components

* Changeset

* Move Viteception to RSC plugin. Augment Vite module graph. Bundle client components in boundary chunks

* Minor refactor of internal components to reduce generated chunks

* Changeset

* Update plugin with latest changes

* Maybe fix Windows paths

* Fix undefined variable

* Add moduleSideEffects info

* Sync React experimental with upstream

* Deprecate `enableStreaming` (#1401)

* Deprecate enableStreaming option

* Changeset

* Add docs

* Apply suggestions from code review

Co-authored-by: Michelle Vinci <[email protected]>

* Fix link

Co-authored-by: Michelle Vinci <[email protected]>

* Move client options to Hydrogen config (#1418)

* Move client options to Hydrogen config

* Update docs

* Changeset

* Remove global config (#1422)

* Remove global config

* Fix unit tests

* Move global context to request internals (#1423)

* Move global context to request internals

* Changeset

Co-authored-by: Josh Larson <[email protected]>

* Support async logs (#1424)

* Move global context to request internals

* Changeset

* Support async logs

* Change docs example

* Changeset

* Make sure waitUntil exists

Co-authored-by: Josh Larson <[email protected]>

* Rename internal Hydrogen global variables (#1425)

* Rename hydrogen globals

* Changeset

Co-authored-by: Josh Larson <[email protected]>

* Rename Request/Response classes to `HydrogenRequest` and `HydrogenResponse` (#1408)

* Rename `ServerComponentRequest` to `HydrogenRequest`

* Move `HydrogenRequest` out of weird Hydration folder

* Move test, too

* Rename `ServerComponentResponse` to `HydrogenResponse`

* Update old references of names

* Fix broken references

* Call out breaking changes in changesets

* Move non-CJS files out of `framework` into `foundation` (#1409)

* Move HydrogenRequest to foundation

* Move HydrogenResponse to foundation

* Move HydrogenRequest test

* Move Cache things to foundation

* Move runtime to foundation

* Move Html to foundation

* Move rsc stuff to entry-client

* StackBlitz: temporary start command workaround (#1434)

* Ignore skipped tests to avoid CI noise (#1432)

* Support Node 18 by avoiding `Headers.raw()` (#1427)

* Split cookies manually instead of using `Headers.raw()`

* Add Node v18 to the testing matrix

* Add changeset

* Fix types, logic, and bundling issues

* Add support for sending ReadableStream to node responses

* Update set-cookie-parser to enhance tree-shaking in workers

* Update packages/hydrogen/src/entry-server.tsx

Co-authored-by: Fran Dios <[email protected]>

* Use existing bufferReadableStream utility

* Don't run tests on Node 17 anymore

Co-authored-by: Fran Dios <[email protected]>

* Implement the account details pages (#1334)

* add account create form

add login form

move login to api route and set it in response & server

get e2e login & logout working

remove setting cookie directly into the server

simplify logout

simplify login

condition render account route using customerAccessToken

add account icon link

rename account route and add no cache

add no cache to customer related query & mutation

move login form to a different route

add register & recover route and create account folder

add account creation flow

fix account login redirect

replace cookie module with worktop/cookie

add checking to account details

add customer recover form

add password reset flow

add more test to cart provider

refactor useCookie to useCustomer instead

if user logined already, use the access token for cart creation

explore multipass login

fix up customer related toolings using sessions

remove @shopify/react-form from login

Remove @shopify/react-form from account create

remove @shopify/react-form from password recover

remove @shopify/react-form from password reset

remove @shopify/react-form

* Fixes

* Fix lint problems

* Fix error handling on account creation

* Fixes to login form

* Fix layout for desktop

* Fix create account page

* Fix recovery page

* Fixes

* Fixes

* Move AccountProfile image to a static svg

* Remove multipass stuff for now

* Mo fixes

* Fix lint errors

* Add docs

* Add docs and changeset

* Update the useCustomer hook

* Update docs/hooks/global/usecustomer.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/hooks/global/usecustomer.md

Co-authored-by: Michelle Vinci <[email protected]>

* Prevent account pages from being indexed by bots

* Update docs

* Remove multipassify for now

* Fix verbiage

* Fix docs

* Add activate account page and move client components into common directory

* Fix gql

* Remove `useCustomer` hooks

* Implement account pages

* Fixes

* Fixes

* Fix bad merge

* Fixes

Co-authored-by: Michelle Chen <[email protected]>
Co-authored-by: Michelle Vinci <[email protected]>

* Allow scroll restoration to be disabled (#1431)

* Allow scroll restoration to be disabled

* Update examples

* Revert to prior default value

* Always restore scroll on pop events, regardless of initial intent

* Change to `scroll`

Co-authored-by: Bret Little <[email protected]>

* [Hydrogen docs]: Specify experimental features (#1445)

* call out experimental features

* add experimental note to showqueryTiming option

* [Hydrogen docs]: Remove references to render props (#1442)

* remove references to render props

* reference customizing components section

* typo fixes (#1446)

* fix note (#1448)

* [Hydrogen docs]: Update app scaffolding commands (#1292)

* update commands

* typo

* typo

* Remove writeHead and make status writable (#1433)

* Remove writeHead and make status writable

* Changeset

* Cleanup

* Add highWaterMark default to React Flight readable (#1451)

* Improve CPU performance in RSC (#1452)

* Improve CPU performance in RSC check

* Changeset

* Generate a default srcset for an image returned by the Shopify CDN (#1330)

* feat: add default img srcset to Shopify images

* feat: add custom widths to Image srcset

* doc: add srcset documentation

* doc: add change set

* feat: lift widths prop to Image level

* feat: use the available loader to generate srcset

* feat:reduce srcset to max-width without distortion

* test: add default img srcset test

* Update packages/hydrogen/src/components/Image/Image.tsx

Co-authored-by: Michelle Vinci <[email protected]>

* doc: update Image docs with widths prop changes

* feat: generate srcset for extarnal images

* Update docs/components/primitive/image.md

Co-authored-by: Michelle Vinci <[email protected]>

* test: add test for images using src

Co-authored-by: Michelle Vinci <[email protected]>
Co-authored-by: Anthony Frehner <[email protected]>

* Improve error message when storefront API is not JSON (#1444)

* Propagate a better error message when the response from the storefront API is not JSON parseable

* Shopify analytics 2 (#1325)

* Instrumented page view and make sure Shopfiy live view works

Co-authored-by: Michelle Vinci <[email protected]>

* [ci] release v1.x-2022-07 (#1404)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Get changelogs to see the new name

* Try to retrigger changeset (#1459)

* Product provider work (#1397)

* saving progress

* Saving progress

I think I have the code all working, it's now just updating tests and stuff. I updated the docs but they probably need to be cleaned up more.

* Working on tests

* Update docs/components/product-variant/productoptionsprovider.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/components/product-variant/productprice.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/hooks/product-variant/useproductoptions.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/hooks/product-variant/useproductoptions.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/components/product-variant/productoptionsprovider.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/components/product-variant/productoptionsprovider.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/components/product-variant/productoptionsprovider.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/components/product-variant/productoptionsprovider.md

Co-authored-by: Michelle Vinci <[email protected]>

* Get tests passing and fix a lot of issues in the meantime

* Update docs to show nodes instead of edges->node

* Replace ProductProvider with ProductOptionsProvider

* Fix issue with useEffect

* update selectedoptions on initialVariantId change

Co-authored-by: Michelle Vinci <[email protected]>

* Fix doc links (#1460)

* fix doc links

* add changeset

* Remove demo-store frontmatter

* Revert "[ci] release v1.x-2022-07 (#1404)" (#1462)

This reverts commit c05c999.

* [ci] release v1.x-2022-07 (#1461)

* [ci] release v1.x-2022-07

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Anthony Frehner <[email protected]>

* fix link (#1463)

* Lint changesets (#1464)

* Add script to lint changesets

* Add note about avoiding headings as first line of changesets, and a linter for that

* Add more specific actionable stuff

* Try removing emoji

* Revert "Try removing emoji"

This reverts commit 2ce6301.

* Add final success message

* Remove unused dependencies (#1457)

Co-authored-by: Anthony Frehner <[email protected]>

* Cart types update (#1237)

* saving progress

* update queries, types, and add documentation

* Saving progress; I think I'm done but the SFAPI may be down?

* Update docs

* Update .changeset/wet-dingos-kick.md

Co-authored-by: Josh Larson <[email protected]>

* Update types and make a small update to CartLinePrice

Co-authored-by: Josh Larson <[email protected]>

* Updates yarn lock

* Remove unconfig vite files

* Moves demo-store to demo-store-neue folder

* Moves demo-store-archive to demo-store

* Replaces dynamic import with CSS classes

* Temp switch to non-aliased Header/Footer imports to fix dev

* Removes unconfig vite file

* Updates Favicon design

* Hides cart badge when 0

* Fixes Product Page with updated ProductOptionsProvider

* Updates Cart page for dark mode and Icon colors

* Fixes broken query on Collection page

* Fixes imports and other linting errors across several files

* Fix `ProductGrid`

* Fix locations index route

Co-authored-by: Matt Seccafien <[email protected]>
Co-authored-by: Michelle Vinci <[email protected]>
Co-authored-by: Fran Dios <[email protected]>
Co-authored-by: Josh Larson <[email protected]>
Co-authored-by: Bret Little <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Scott Dixon <[email protected]>
Co-authored-by: BradMurchison <[email protected]>
Co-authored-by: Josh Larson <[email protected]>
Co-authored-by: Michelle Chen <[email protected]>
Co-authored-by: Emilio Franco <[email protected]>
Co-authored-by: Anthony Frehner <[email protected]>
Co-authored-by: Helen Lin <[email protected]>
Co-authored-by: Daniel Rios Pavia <[email protected]>
lordofthecactus added a commit that referenced this pull request Jun 8, 2022
* Inits new demo store template

* Update package.json

* Use `gql` from `hydrogen` in demo store v2

* Remove server utilities from client build (#1363)

* Remove server utilities from client build

* Changeset

Co-authored-by: Josh Larson <[email protected]>

* remove stray console.log (#1364)

* Prevent encoded props from double decoding  (#1360)

* Prevent encoded props from double decoding in the RSC flight inlined in the initial page load

* Removed unused htmlDecode

* Update stackblitz workflow to manually update files (#1365)

This needs to happen in a single commit as opposed to
concurrent/parallel workflows because they both check out
the main branch first and then force push.

* Add rule override (#1367)

* Adds @types/react to typescript example (#1362)

* Update docs to describe the difference between experimental and unstable releases (#1366)

* Explicitly log errors for Flight onError (#1320)

* wip: Explicitly log errors for Flight onError

* Rename variables for clarity

* Add changeset

* Revert streaming thing

* Bump hydrogen eslint plugin version (#1368)

* Bump hydrogen eslint plugin version

This gets rid of the annoying error we're seeing while developing the monorepo

* Use new name for hook

* Update for more lax server component hooks rules

* Drop prefixes from template names (#1369)

* Drop prefixes from template names

* Update publish_stackblitz.yml

* Update index.server.jsx

* Update index.server.jsx

* Typescript updates (#1374)

* Update typescript and ts-node

ts-node was required to update because of this comment jestjs/jest#12655 (comment)

* Dedupe the react/types and finish the update

* Fix Image typescript issues (#1371)

* Add TS test-ish things for Image's TS types

Make any console.warn only happen in dev

Fix Image's weird types issue with Simplify from type-fest

Update the readme for the TS example

* Fix dev warnings and a type issue

* add changelog

* Update yarn.lock

* Adds basic layout components and content for 404

* @benjaminsehl/demo store neue (#1387)

* Adds basic components for Collection. Refines Product Card. Co-locates mock data.

* Adds Locations page, refines existing components

* Runs yarn format

* Updates Icons to work with SSR

* Removes custom spacing from Tailwind config

* Updates temp country banner

* Refactors product card, adds search page, beginning of product page

* Adds search functionality, adds real data to homepage, improves components

* Completes desktop hero with dynamic data

* Improves layout and adds data for homepage, cart, header, product card, collections, swimlane

* Updates to locations, collections, products all

* Style consistency updates and addition of dark mode

* Adds functioning search bar on search page

* Adds queries and dynamic data for components

* Update styling on hero and search

* Yarn format

* Updates to hero and search

* Revert "Updates to hero and search"

This reverts commit 145defe.

* Style tweaks to header

* Complete locations template

* Update Location template layout

* Demo store neue: collection pagination (#1400)

* Dynamic Product Swimlane & Mobile Layouts (#1412)

* Product Swimlane now works with product recommendations

* Updates Header for mobile

* Mobile layout for header, footer, and key layout components

* Adds expanding menus to footer

* Adds mobile layout for search

* @benjaminsehl/pdp demo store neue (#1414)

* Product Swimlane now works with product recommendations

* Updates Header for mobile

* Mobile layout for header, footer, and key layout components

* Adds expanding menus to footer

* Adds mobile layout for search

* Basic product page layout

* Adds URL param control to PDP

* Added account pages from demo-store (#1410)

* Added account pages from demo-store

* Autofocus email and password inputs

* adds cart functionality (#1417)

* Wire up cart page

* Fixes typeof error in swimlane

* Wires up cart data

* Demo store neue: Intersection Observer for infinite scroll (#1421)

Co-authored-by: Benjamin Sehl <[email protected]>

* Dy orders (#1420)

* wip - display empty state for order history if customer doesn't have any orders yet

* Updated empty state based on 404 page

* Display custom welcome heading if customer account has a first name

* Added featured collections, products, and locations sections to account details page

* Styling updates on forms

* Styling, padding, alignment for order history

* Demo store neue: clean up country selector (#1436)

* Renames metaobjects to contentEntries

* Updates metaobject references to contentEntry

* Minor visual fixes and a catch for a bug with availableOnSale

* Moves Neue to main demo store, moves existing demo store to demo-store-archive

* Display order history as a grid of cards (#1440)

* Display order history as grid of cards
* Use Text component
* Fixed text spacing

* Fix new demo store build after update to [email protected] (#1454)

* Remove package-lock file

* Update to `@shopify/[email protected]` and `@shopify/[email protected]`

* Remove `graphql-tag`

* Update yarn lock file with latest new demo store changes

* Fix environment variable in `App.server.jsx`

* Use default routes in hydrogen config

* Revert "Fix new demo store build after update to [email protected] (#1454)"

This reverts commit ba43a31.

Easier to merge 0.23.0 and then update given the name changes in folders causing too many conflicsts

* Upgrade Demo Store Neue to v23 (#1467)

* Center logo in Demo Store header (#1378)

* Template favicons updated with SVGs, and moved to /src/assets (#1377)

* Automatically fix GQL imports in exisiting Hydrogen Projects (#1336)

* Add eslint rule to fix gql imports

* Update README.md

* add tests with fixer

* Update packages/eslint-plugin/src/rules/prefer-gql/README.md

Co-authored-by: Michelle Vinci <[email protected]>

* Apply suggestions from code review

Co-authored-by: Michelle Vinci <[email protected]>

* Final copy edits

Co-authored-by: Michelle Vinci <[email protected]>

* Remove CLI scripts (#1379)

* Support ESLint v8 in `eslint-plugin` (#1373)

* remove and reorganize duplicated content (#1380)

* Simplify `routes` property in Hydrogen config (#1313)

* Drop import.meta.globEager in dev

* Refactor variables and virtual modules

* Fix code after cherry-pick

* Extract Vitception

* Use Vitception to load routes during build

* Use static imports to fix build

* Add default routes path

* Fix types and paths

* Fix dirPrefix issues

* Fix HMR in route files

* Use default value for config.routes

* Fix issue in Node 16.15

* Extract virtual-files plugin for clarity

* Cleanup

* Fix unit tests

* Update docs

* Changeset

* Cleanup

* Regenerate broken graphql.schema.json

* Disable rules-of-hooks in server components

* Disable prefer-gql in test

* Apply suggestions from code review

Co-authored-by: Michelle Vinci <[email protected]>

* Revert "Disable prefer-gql in test"

This reverts commit d130f1c.

* Revert "Disable rules-of-hooks in server components"

This reverts commit e0ffbf6.

Co-authored-by: Michelle Vinci <[email protected]>

* Update formatting of release notes

* minor fixes (#1391)

* Remove hello world code (#1392)

* [ci] release v1.x-2022-07 (#1343)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Remove broken changesets

* [Hydrogen docs]: User authentication (#1353)

* initial draft

* remove useCustomer docs

* add address and order routes

* integrate feedback

* Make graphql-tag a dep instead of a devDep to fix dev errors (#1394)

* [ci] release v1.x-2022-07 (#1396)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* StackBlitz: turn off auto-save (#1386)

* Simplify renderHydrogen internal logic (#1384)

* Simplify entry-server code

* Combine stream and render into runSsr

* Rename some variables and functions for consistency

* Fix: write head before checking redirects in Node

* Remove unnecessary check and add comment

* These li'l babies need a flipperoo (#1398)

* Rename utility `isClient` to `isBrowser` (#1389)

* Rename utility `isClient` to `isBrowser`

* Switch to document check instead of window

* Apply suggestions from code review

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/utilities/isserver.md

Co-authored-by: Michelle Vinci <[email protected]>

Co-authored-by: Michelle Vinci <[email protected]>

* Fix unique key issue in old demo store template

* Workers support streaming now (#1227)

* I think streaming is supported now?

* Bump

* Add changeset

* style guide fixes (#1407)

* Move logger options to Hydrogen config (#1403)

* Stop using globalThis for logger and minor refactor

* Move logger options to Hydrogen config file

* Update unit tests

* Remove setLogger call from e2e tests

* Always call setLogger for HMR

* Remove unnecessary type

* Add docs

* Changeset

* Fix link

* Apply suggestions from code review

Co-authored-by: Michelle Vinci <[email protected]>

Co-authored-by: Michelle Vinci <[email protected]>

* Fix CountrySelector styling in demo store (#1415)

* fix-demo-store-country-selector-styling

* move conditional classes back to newline

* add changeset

* Fix logger title in docs (#1419)

* Fix logger title in docs

* Fix unrelated changeset

* Suppress confusing warnings (#1399)

* Supress confusing warnings

* Changeset

* Typo

* Improve component bundling and reduce total downloaded files (#1361)

* Skip module references for nested client components

* Changeset

* Move Viteception to RSC plugin. Augment Vite module graph. Bundle client components in boundary chunks

* Minor refactor of internal components to reduce generated chunks

* Changeset

* Update plugin with latest changes

* Maybe fix Windows paths

* Fix undefined variable

* Add moduleSideEffects info

* Sync React experimental with upstream

* Deprecate `enableStreaming` (#1401)

* Deprecate enableStreaming option

* Changeset

* Add docs

* Apply suggestions from code review

Co-authored-by: Michelle Vinci <[email protected]>

* Fix link

Co-authored-by: Michelle Vinci <[email protected]>

* Move client options to Hydrogen config (#1418)

* Move client options to Hydrogen config

* Update docs

* Changeset

* Remove global config (#1422)

* Remove global config

* Fix unit tests

* Move global context to request internals (#1423)

* Move global context to request internals

* Changeset

Co-authored-by: Josh Larson <[email protected]>

* Support async logs (#1424)

* Move global context to request internals

* Changeset

* Support async logs

* Change docs example

* Changeset

* Make sure waitUntil exists

Co-authored-by: Josh Larson <[email protected]>

* Rename internal Hydrogen global variables (#1425)

* Rename hydrogen globals

* Changeset

Co-authored-by: Josh Larson <[email protected]>

* Rename Request/Response classes to `HydrogenRequest` and `HydrogenResponse` (#1408)

* Rename `ServerComponentRequest` to `HydrogenRequest`

* Move `HydrogenRequest` out of weird Hydration folder

* Move test, too

* Rename `ServerComponentResponse` to `HydrogenResponse`

* Update old references of names

* Fix broken references

* Call out breaking changes in changesets

* Move non-CJS files out of `framework` into `foundation` (#1409)

* Move HydrogenRequest to foundation

* Move HydrogenResponse to foundation

* Move HydrogenRequest test

* Move Cache things to foundation

* Move runtime to foundation

* Move Html to foundation

* Move rsc stuff to entry-client

* StackBlitz: temporary start command workaround (#1434)

* Ignore skipped tests to avoid CI noise (#1432)

* Support Node 18 by avoiding `Headers.raw()` (#1427)

* Split cookies manually instead of using `Headers.raw()`

* Add Node v18 to the testing matrix

* Add changeset

* Fix types, logic, and bundling issues

* Add support for sending ReadableStream to node responses

* Update set-cookie-parser to enhance tree-shaking in workers

* Update packages/hydrogen/src/entry-server.tsx

Co-authored-by: Fran Dios <[email protected]>

* Use existing bufferReadableStream utility

* Don't run tests on Node 17 anymore

Co-authored-by: Fran Dios <[email protected]>

* Implement the account details pages (#1334)

* add account create form

add login form

move login to api route and set it in response & server

get e2e login & logout working

remove setting cookie directly into the server

simplify logout

simplify login

condition render account route using customerAccessToken

add account icon link

rename account route and add no cache

add no cache to customer related query & mutation

move login form to a different route

add register & recover route and create account folder

add account creation flow

fix account login redirect

replace cookie module with worktop/cookie

add checking to account details

add customer recover form

add password reset flow

add more test to cart provider

refactor useCookie to useCustomer instead

if user logined already, use the access token for cart creation

explore multipass login

fix up customer related toolings using sessions

remove @shopify/react-form from login

Remove @shopify/react-form from account create

remove @shopify/react-form from password recover

remove @shopify/react-form from password reset

remove @shopify/react-form

* Fixes

* Fix lint problems

* Fix error handling on account creation

* Fixes to login form

* Fix layout for desktop

* Fix create account page

* Fix recovery page

* Fixes

* Fixes

* Move AccountProfile image to a static svg

* Remove multipass stuff for now

* Mo fixes

* Fix lint errors

* Add docs

* Add docs and changeset

* Update the useCustomer hook

* Update docs/hooks/global/usecustomer.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/hooks/global/usecustomer.md

Co-authored-by: Michelle Vinci <[email protected]>

* Prevent account pages from being indexed by bots

* Update docs

* Remove multipassify for now

* Fix verbiage

* Fix docs

* Add activate account page and move client components into common directory

* Fix gql

* Remove `useCustomer` hooks

* Implement account pages

* Fixes

* Fixes

* Fix bad merge

* Fixes

Co-authored-by: Michelle Chen <[email protected]>
Co-authored-by: Michelle Vinci <[email protected]>

* Allow scroll restoration to be disabled (#1431)

* Allow scroll restoration to be disabled

* Update examples

* Revert to prior default value

* Always restore scroll on pop events, regardless of initial intent

* Change to `scroll`

Co-authored-by: Bret Little <[email protected]>

* [Hydrogen docs]: Specify experimental features (#1445)

* call out experimental features

* add experimental note to showqueryTiming option

* [Hydrogen docs]: Remove references to render props (#1442)

* remove references to render props

* reference customizing components section

* typo fixes (#1446)

* fix note (#1448)

* [Hydrogen docs]: Update app scaffolding commands (#1292)

* update commands

* typo

* typo

* Remove writeHead and make status writable (#1433)

* Remove writeHead and make status writable

* Changeset

* Cleanup

* Add highWaterMark default to React Flight readable (#1451)

* Improve CPU performance in RSC (#1452)

* Improve CPU performance in RSC check

* Changeset

* Generate a default srcset for an image returned by the Shopify CDN (#1330)

* feat: add default img srcset to Shopify images

* feat: add custom widths to Image srcset

* doc: add srcset documentation

* doc: add change set

* feat: lift widths prop to Image level

* feat: use the available loader to generate srcset

* feat:reduce srcset to max-width without distortion

* test: add default img srcset test

* Update packages/hydrogen/src/components/Image/Image.tsx

Co-authored-by: Michelle Vinci <[email protected]>

* doc: update Image docs with widths prop changes

* feat: generate srcset for extarnal images

* Update docs/components/primitive/image.md

Co-authored-by: Michelle Vinci <[email protected]>

* test: add test for images using src

Co-authored-by: Michelle Vinci <[email protected]>
Co-authored-by: Anthony Frehner <[email protected]>

* Improve error message when storefront API is not JSON (#1444)

* Propagate a better error message when the response from the storefront API is not JSON parseable

* Shopify analytics 2 (#1325)

* Instrumented page view and make sure Shopfiy live view works

Co-authored-by: Michelle Vinci <[email protected]>

* [ci] release v1.x-2022-07 (#1404)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Get changelogs to see the new name

* Try to retrigger changeset (#1459)

* Product provider work (#1397)

* saving progress

* Saving progress

I think I have the code all working, it's now just updating tests and stuff. I updated the docs but they probably need to be cleaned up more.

* Working on tests

* Update docs/components/product-variant/productoptionsprovider.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/components/product-variant/productprice.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/hooks/product-variant/useproductoptions.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/hooks/product-variant/useproductoptions.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/components/product-variant/productoptionsprovider.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/components/product-variant/productoptionsprovider.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/components/product-variant/productoptionsprovider.md

Co-authored-by: Michelle Vinci <[email protected]>

* Update docs/components/product-variant/productoptionsprovider.md

Co-authored-by: Michelle Vinci <[email protected]>

* Get tests passing and fix a lot of issues in the meantime

* Update docs to show nodes instead of edges->node

* Replace ProductProvider with ProductOptionsProvider

* Fix issue with useEffect

* update selectedoptions on initialVariantId change

Co-authored-by: Michelle Vinci <[email protected]>

* Fix doc links (#1460)

* fix doc links

* add changeset

* Remove demo-store frontmatter

* Revert "[ci] release v1.x-2022-07 (#1404)" (#1462)

This reverts commit c05c999.

* [ci] release v1.x-2022-07 (#1461)

* [ci] release v1.x-2022-07

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Anthony Frehner <[email protected]>

* fix link (#1463)

* Lint changesets (#1464)

* Add script to lint changesets

* Add note about avoiding headings as first line of changesets, and a linter for that

* Add more specific actionable stuff

* Try removing emoji

* Revert "Try removing emoji"

This reverts commit 2ce6301.

* Add final success message

* Remove unused dependencies (#1457)

Co-authored-by: Anthony Frehner <[email protected]>

* Cart types update (#1237)

* saving progress

* update queries, types, and add documentation

* Saving progress; I think I'm done but the SFAPI may be down?

* Update docs

* Update .changeset/wet-dingos-kick.md

Co-authored-by: Josh Larson <[email protected]>

* Update types and make a small update to CartLinePrice

Co-authored-by: Josh Larson <[email protected]>

* Updates yarn lock

* Remove unconfig vite files

* Moves demo-store to demo-store-neue folder

* Moves demo-store-archive to demo-store

* Replaces dynamic import with CSS classes

* Temp switch to non-aliased Header/Footer imports to fix dev

* Removes unconfig vite file

* Updates Favicon design

* Hides cart badge when 0

* Fixes Product Page with updated ProductOptionsProvider

* Updates Cart page for dark mode and Icon colors

* Fixes broken query on Collection page

* Fixes imports and other linting errors across several files

* Fix `ProductGrid`

* Fix locations index route

Co-authored-by: Matt Seccafien <[email protected]>
Co-authored-by: Michelle Vinci <[email protected]>
Co-authored-by: Fran Dios <[email protected]>
Co-authored-by: Josh Larson <[email protected]>
Co-authored-by: Bret Little <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Scott Dixon <[email protected]>
Co-authored-by: BradMurchison <[email protected]>
Co-authored-by: Josh Larson <[email protected]>
Co-authored-by: Michelle Chen <[email protected]>
Co-authored-by: Emilio Franco <[email protected]>
Co-authored-by: Anthony Frehner <[email protected]>
Co-authored-by: Helen Lin <[email protected]>
Co-authored-by: Daniel Rios Pavia <[email protected]>

* Remove package lock file

* Temporarily comment out missing account components and fixes small issues

* Update to `[email protected]`

* Fix graphql schema

Co-authored-by: Benjamin Sehl <[email protected]>
Co-authored-by: Matt Seccafien <[email protected]>
Co-authored-by: Fran Dios <[email protected]>
Co-authored-by: Josh Larson <[email protected]>
Co-authored-by: Bret Little <[email protected]>
Co-authored-by: JrFelix540 <[email protected]>
Co-authored-by: Anthony Frehner <[email protected]>
Co-authored-by: Scott Dixon <[email protected]>
Co-authored-by: Dave Yen <[email protected]>
Co-authored-by: Michelle Vinci <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: BradMurchison <[email protected]>
Co-authored-by: Josh Larson <[email protected]>
Co-authored-by: Michelle Chen <[email protected]>
Co-authored-by: Emilio Franco <[email protected]>
Co-authored-by: Helen Lin <[email protected]>
@frehner frehner mentioned this pull request Jun 8, 2022
4 tasks
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.

Remove Product Components
6 participants