Skip to content

v-if condition ruins the json editor visualization #85

Closed
@giuliohome

Description

@giuliohome

Before you start, please make sure to:

  • Read the document
  • Have tried the latest version
  • Search to see if your issue already exists
  • Look for / ask questions through appropriate channels like Stack Overflow

Link to minimal (but complete) reproduction

https://github.com/giuliohome-org/repro-jsoneditor-issue/blob/main/src/components/HelloWorld.vue

Steps to reproduce

Main code

          <div v-if="switchMe" > read only</div> 
          <JsonEditorVue v-else v-model="myJSON" /> 
npm i
npm run dev

You see
image
If you click switchCondition
image
and then back to the previous json editor if you click again.

But now, if you edit a value
for example "a": 2
and you click 2 times again
image
the content visualization is ruined (and formatting does not work either)

What is expected?

Setting the v-if condition to false and back to true should not change the editor content visualization

What is actually happening?

A wrongly formatted text is displayed instead

image

System Info

Latest Vue 3 and latest json-editor-vue  on any Linux (e.g. Ubuntu) OS.

Package Manager

npm

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions