Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prop name is an array, throw an error "TypeError: str.replace is not a function" #1470

Closed
blusoul opened this issue Jun 5, 2021 · 2 comments
Labels

Comments

@blusoul
Copy link

blusoul commented Jun 5, 2021

Version

6.0.0-beta.12

Browser and OS info

windows 10 21H1 Chrome 90 / mac Chrome 90.0.4430.212

Steps to reproduce

  1. I create a component "App", it's prop name is an array
  2. I use vue-devtools find components "App",
  3. throw an error "TypeError: str.replace is not a function", and components tree not work
<template>
  <div id="app">
    <p>when name is an array {{JSON.stringify(name)}}</p>
    <p>I find Commponents 'App'</P>
    <p>throw an error <span class="warn">"TypeError: str.replace is not a function"</span></P>
  </div>
</template>

<script>
export default {
  name: 'App',
  props: {
    // when name is an array, throw an error "TypeError: str.replace is not a function"
    name: {
      type: Array,
      default: () => ['start', 'end']
    }
  },
}
</script>

image
image
image

  1. Demo

What is expected?

no error

What is actually happening?

throw an error "TypeError: str.replace is not a function", and components tree not work

// packages\app-backend-vue2\src\components\tree.ts
// packages\app-backend-vue3\src\components\filter.ts
function isQualified (instance): boolean {
 // instance.name is prop name
 const name = classify(instance.name || getInstanceName(instance)).toLowerCase()
 return name.indexOf(filter) > -1
}
@Akryum
Copy link
Member

Akryum commented Jun 7, 2021

I don't reproduce with latest next branch and your demo link.

@Akryum Akryum closed this as completed Jun 7, 2021
@blusoul
Copy link
Author

blusoul commented Jun 10, 2021

I upgrade to 6.00 beta 14 the error is existed.
image
mac / chrome 91.0.4472.77 / Vue.js devtools 6.0.0 beta 14 | Vue.js devtools 5.3.4
step 1: link to codesandbox
step 2: keypress F12 vue devtools
step 3: findComponent App

@Akryum Akryum reopened this Jun 10, 2021
@Akryum Akryum closed this as completed in 14085e2 Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants