A recent update removes “=” in $route.query

Versions

  • nuxt: 2.14.12
  • node: 15.4.0

Reproduction

I use algolia on a nuxt application, and I push the currentFilter in the url:

this.$router.push({ query: { numericFilters: 'capacity >= 5' } })

The url is then : http://localhost:3000/fr/recherche?numericFilters=capacity%%20%%3E%%3D%%205
On refresh, server-side with asyncData I get the query with route.query

  • in v2.14.10 the decoded result was capacity >= 5
  • In your current version the result is capacity >

On url decode https://www.freeformatter.com/url-encoder.html#ad-output
The result is capacity >= 5

The cause might come from your HotFix #8494 named Fix issues with URL handling (resolves #8497, #8493, #8458, #8457)

Additional Details

Steps to reproduce

Steps to reproduce

The $route.query return { "numericFilters": "capacity >= 5" }
The querySsr return { "numericFilters": "capacity >" }

<template>
  <div>
    <button @click="addQuery">Add query on url</button>
    <p>
      Query on clientSide : <strong>{{ $route.query }}</strong>
    </p>
    <p>
      Query on ssr : <strong>{{ querySsr }}</strong>
    </p>
  </div>
</template>

<script>
export default {
  asyncData({ route }) {
    // eslint-disable-next-line no-console
    console.log(route.query)

    return {
      querySsr: route.query,
    }
  },
  data() {
    return {
      isOpen: false,
    }
  },
  methods: {
    addQuery() {
      this.$router.push({ query: { numericFilters: 'capacity >= 5' } })
    },
  },
}
</script>

<style>
div {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
button,
p {
  margin: 0 auto 15px;
}
</style>

Capture d’écran 2021-01-07 à 14 33 17

What is Expected?

Return the result of the UrlDecode => { "numericFilters": "capacity >= 5" } like before

What is actually happening?

1 possible answer(s) on “A recent update removes “=” in $route.query

  1. Hi @joffreyBerrier. Issue with parsing = in query values resolved in ufo@0.5.3. Would you please try upgrading with yarn upgrade nuxt or npm up nuxt and try again? (locally testing, issue seems fixed so closing issue but please ping if not to investigate)