Coder Social home page Coder Social logo

Comments (3)

uip-robot-zz avatar uip-robot-zz commented on July 17, 2024

This issue has been linked to a new work item: W-11179299

from pwa-kit.

bendvc avatar bendvc commented on July 17, 2024

By applying the following patch from within your pwa folder you can fix this issue if you pwa was generated as version 2.0.0 of 2.1.0.

@@ -0,0 +1,37 @@
diff --git a/packages/template-retail-react-app/app/utils/url.js b/packages/template-retail-react-app/app/utils/url.js
index 468f5851..a4b3bc9b 100644
--- a/packages/template-retail-react-app/app/utils/url.js
+++ b/packages/template-retail-react-app/app/utils/url.js
@@ -53,6 +53,10 @@ export const rebuildPathWithParams = (url, extraParams) => {
         // 0 is a valid value as for a param
         if (!value && value !== 0) {
             params.delete(key)
+        } else if (Array.isArray(value)) {
+            value.map((v) => {
+                params.append(key, v)
+            })
         } else {
             params.set(key, value)
         }
@@ -281,7 +285,20 @@ export const buildPathWithUrlConfig = (relativeUrl, configValues = {}, opts = {}
         })
     }
 
-    const queryParams = {...Object.fromEntries(params)}
+    const queryParams = Array.from(params.entries()).reduce((acc, curr) => {
+        const [key, value] = curr
+        const currValue = acc[key]
+
+        if (typeof currValue === 'string') {
+            acc[key] = [acc[key], value]
+        } else if (Array.isArray(currValue)) {
+            acc[key].push(value)
+        } else {
+            acc[key] = value
+        }
+
+        return acc
+    }, {})
     let basePathSegments = []
 
     // get the default values for site and locale

from pwa-kit.

adamraya avatar adamraya commented on July 17, 2024

I'm closing this issue since it's fixed on version 2.2.0. The above patch can be applied to projects generated from versions 2.0.0 and 2.1.0.

from pwa-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.