dword-design/nuxt-route-meta

Values set as false disappear

alxgrepe opened this issue · 2 comments

When setting one of the metadata fields to false, they disappear completely from the $route.meta .

File test.vue:

<template>
<code>
isTrue: {{ this.$route.meta.isTrue }}
isFalse: {{ this.$route.meta.isFalse }}
isOther: {{ this.$route.meta.isOther }}
isAlsoTrue: {{ this.$route.meta.isAlsoTrue }}
isAlsoFalse: {{ this.$route.meta.isAlsoFalse }}
</code>
</template>

<script>
export default {
  isTrue: true,
  isFalse: false,
  isOther: 'other',
  meta: {
    isAlsoTrue: true,
    isAlsoFalse: false,
  },
}
</script>

<style scoped>
code {  white-space: pre-wrap; }
</style>

Output:

  isTrue: true
  isFalse: 
  isOther: other
  isAlsoTrue: true
  isAlsoFalse: 

(I'm using v2.0.6 and nuxt v2.15.3.)

@alxgrepe Thanks for discovering this issue! Should be fixed by running npm update or yarn upgrade. Reason was a bug in ast-to-literal.

Awesome @dword-design, thanks for the quick fix - I can confirm that it works perfectly now!