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

freeze can't make TypedArray or ArrayBuffer unobservable #9706

Closed
shaunc opened this Issue Mar 15, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@shaunc
Copy link

shaunc commented Mar 15, 2019

Version

2.6.8

Reproduction link

https://codesandbox.io/s/03kyrwlkn0?fontsize=14

Steps to reproduce

Try to freeze a data element which is a TypedArray. Note if you remove the Object.freeze will work.

What is expected?

unobserved data

What is actually happening?

impossible to freeze


I am designing a visualization tool which needs to access large amounts of data. Eventually the data will be in flatbuffers (which are in ArrayBuffers); for the moment I am testing using a TypedArray. Although blocks of data may change, the contents of arrays will not. I need to prevent Vue from trying to create observers for content cells.

Note: in my test application the data is actually in Vuex -- however it is only when I access it to display a chunk that I run into a bottleneck, so I believe it is a Vue problem. However, I can open an issue on Vuex if that would be more appropriate.

@yyx990803

This comment has been minimized.

Copy link
Member

yyx990803 commented Mar 15, 2019

  1. Object.freeze cannot be called on TypedArray is a JavaScript behavior
  2. Vue 2.x doesn't observe anything other than plain objects or plain Arrays so there's no need to freeze it anyway.

@yyx990803 yyx990803 closed this Mar 15, 2019

@shaunc

This comment has been minimized.

Copy link
Author

shaunc commented Mar 15, 2019

Ok -- sorry... I thought it must have been that. When my data-getting function just calculates a dummy value and passes it back it works without delay. When I access the typed array, however, I see a big performance hit. (Could it be the use of a Getter from Vuex to get the data? I'll ask on stack overflow how to debug it.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.