Skip to content

Does snipcart support nextjs app router? #2

@heiemooa

Description

@heiemooa

Hi,

I noticed that the current Memo uses the nextjs page router, and I encountered a problem when I tried to use the app router. There is no problem when clicking cart or checkout for the first time. And it will enter the hash route of #/checkout or #/cart. So far so good.

But when I refresh the current page, I will encounter an error:

app-router.tsx:252 Uncaught (in promise) TypeError: Cannot create property '__NA' on string ''
    at copyNextJsInternalHistoryState (app-router.tsx:252:3)
    at History.replaceState (app-router.tsx:576:11)
    at e.onCreate (snipcart.js:51:176685)
    at new e (snipcart.js:51:175447)
    at rf (snipcart.js:51:178544)
    at snipcart.js:51:349855
    at c (snipcart.js:16:2622)
    at Object.next (snipcart.js:16:1917)
    at a (snipcart.js:16:1492)

Question:

  1. Does snipcart not support nextjs app router?
  2. If it does, how should it be handled? Can you provide a demo?
Image Image Image

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