2

I have one problem. I have

data: {
        tracks: []
    }

And tracks array will contain a complex object. And when I assign a new value to tracks nested object to become reactivity. But I just don't need not deep reactivity object. How can I do it without created function or JSON.parse?

Because tracks used with Cesium framework and use Vue getter. And FPS becomes 10-15. Without Vue have 50-60 FPS

2 Answers 2

3

Use Object.freeze or Object.defineProperty (you only need configurable: false) to prevent Vue from picking up reactivity on large datasets

https://forum.vuejs.org/t/cesium-and-vue-js-data-getters/26928

Sign up to request clarification or add additional context in comments.

Comments

0

You can implement a deep watcher on tracks:

watch: {
  tracks: {
    handler (newVal, oldVal) {
      // implement what you want to do here
      // If you just wanted to force a re-render you can do:
      this.$forceUpdate()
    }
    deep: true,
}

4 Comments

but if I don't want deep watching? it is on default deep watching my objects
Vue can either observe the entire path of your object by using deep or just the top layer (by default). There is no in between. You can only either trigger $forceUpdate yourself every time or use this.$set() every time you change a nested object in tracks. But what's the reason you don't want to use deep anyway? It's exactly meant for those situations.
Because tracks used with Cesium framework and use Vue getter. And FPS becomes 10-15. Without Vue have 50-60 FPS
When I use watch method, I get already array with reactive objects.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.