Skip to content

Question related to weird issue, chart.value is null #3343

Answered by FCnski
FCnski asked this question in Q&A
Discussion options

You must be logged in to vote

I've found the solution, this chart was initialized before the other charts, and when you would leave the page, it wasn't destroyed properly, so when you tried to access it again, it would try to render it again over an existing one causing its value to be null, to solve this, simply add a bool to check if it is really loaded or not, like so:

// Bool to check if its loaded
const loaded = ref(false)

    watch(() => ([...manuais.value]), (val) => {
      if (val !== undefined && val !== null) {
        val.forEach((l) => {
          if (formatDate(l.validade, 'MM/DD/YYYY') > formatDate(Date.now(), 'MM/DD/YYYY')) {
            dadosManuais.value.push({ data: true })
          } else {
     …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@FCnski
Comment options

Answer selected by FCnski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant