Skip to content

EP Product List Provider has no SSR data-injection prop (listing can't be server-rendered) #377

Description

@field123

Gap

EPProductListProvider always fetches products client-side via useProductList. Unlike EPProductProvider (PDP), which accepts a pre-fetched product prop for the SSR hand-off, the list provider has no prop to accept a server-query result. Its full prop surface is Category ID, Search, Sort, Page Size, Preview State.

Consequence: a listing page cannot be server-rendered through the provider. Adding a ep.getProductList server query works (returns real products server-side) but there is nowhere to bind it — the provider ignores it and fetches in the browser regardless.

This is an unintended asymmetry with the PDP.

Expected

Add an advanced SSR hand-off prop to EPProductListProvider (e.g. initialProducts / products, mirroring EPProductProvider.product). When set, seed productGridData from it and skip the initial client fetch; pagination/sort refActions can still fetch subsequent pages. Leaving it empty preserves today's client-fetch behaviour.

Files

  • plasmicpkgs/commerce-providers/elastic-path/src/product-discovery/EPProductListProvider.tsx (props + registration)
  • plasmicpkgs/commerce-providers/elastic-path/src/product-discovery/use-product-list.tsx (accept seed data)

Notes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions