Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://deploy-preview-10419--vue-sfc-playground.netlify.app/#eNp9UstOwzAQ/JWVLwWpJGrhFKWVAPUAB4qAoy95bFOXxLZsJ1RE+XfWrtIWhHrzzsyOZqzt2b3WUdciS1hqCyO0A4uu1UsuRaOVcdCDwaxwokMYYGNUAxPST7jkslDSOmhsBQvos6TPE5jMJsPAZRyDbh0ICUVWbPFMOiftaHhF8zWX63yHhYs2BvE7YHMCyaFUIJUD2i8+f/uo3KLpsPzj5ffS+FCDCtDgsNF15pAmAEi3s2Xfn7aHIY0J8lwqpA/c3TSqxHrB2SiKsijnDGJSpfGZHZsyZynNRlTRzipJH9h7I84K1WhRo1lrJygtZwkExnNZXauv54A50+J0xEPHf/Cd3XuMs1eDIQ9nR85lpkJ3oFfvL7in95GkGm1N6gvkG1pVtz7jQfbQypJin+lC2qdwBkJWH3a1dyjtWMoH9coh6Dmjq3i8UP0U9za6C3tcDmz4Ab7Q11g=
In the playground, using
Object.freeze
to handle proxy objects will result in an error. There should be very few people who would freeze a proxy object.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah,
Object.freeze()
is rarely used. I believe that instead of checking the cache first, we should ensure that the object is notINVALID
before considering the subsequent actions.https://deploy-preview-10419--vue-sfc-playground.netlify.app/#eNp9UkFOwzAQ/MrKl4JUEhU4VWklQD3AgSLg6EvqbFOXxLbsTVoR5e9sUqUtAvXmnZkdzVjbiAfnorpCMRVJUF47goBUubk0unTWEzTgMVWkaxzDLiW1gRbW3pYw4rWRNNIoawJBGXKYQZNOm9UURpNR20oTx+AqAm1ApWqDZ9Jb1g6+VzxfS7NcbVFRtPaI3wPGBpkFYwl4XX39trGrgL7G7K9VEh+6cAseCEtXpIQ8AUCymcyb5rTctknMUMcl2nRx65vSZljMpBhEURqtpICYVUl8ZifGggKHWes82gZr+BebzkgKZUunC/RLR5rDSjGFnum4tCjs7qXHyFc4HvC+4j/4Nuw7TIo3j30eKY4cpT5HOtCLj1fc8/tIco2qYPUF8h2DLaou40H2WJmMY5/p+rTP/S1ok3+GxZ7QhKFUF7RTtr1eCr6JpwvVT3Hvovt+T5pWtD+UnNlX
Although this example is peculiar, in case there is a large amount of code within a single
SFC
, maintained by multiple people, if someone misusesObject.freeze()
and another person proxies the original object, an error would be thrown in the now Vue version. However, if the object isINVALID
, just return the original object directly, in your case, the error won't occur.