Skip to content

Commit

Permalink
fix: findComponent in Suspense for rc.11
Browse files Browse the repository at this point in the history
vuejs/core#2099 introduced a big refactoring in how Suspense works, which broke VTU.
`SuspenseBoundary` no longer exposes the same interface, so our current implementation was not compiling anymore (and throwing at runtime).
This solves the issue and simplifies the current code, as the newly introduced `activeBranch` field now contains the... active branch of the Suspense, so we just have to check that.
  • Loading branch information
cexbrayat committed Sep 16, 2020
1 parent d4ffade commit 153f0e8
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 93 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@types/estree": "^0.0.42",
"@types/jest": "^24.9.1",
"@types/node": "12.12.35",
"@vue/compiler-sfc": "^3.0.0-rc.10",
"@vue/compiler-sfc": "^3.0.0-rc.11",
"babel-jest": "^25.2.3",
"babel-preset-jest": "^25.2.1",
"dom-event-types": "^1.0.0",
Expand All @@ -38,13 +38,13 @@
"ts-jest": "^25.0.0",
"tsd": "0.11.0",
"typescript": "^3.7.5",
"vue": "^3.0.0-rc.10",
"vue": "^3.0.0-rc.11",
"vue-jest": "vuejs/vue-jest#next",
"vue-router": "^4.0.0-alpha.14",
"vuex": "^4.0.0-beta.1"
},
"peerDependencies": {
"vue": "^3.0.0-rc.10"
"vue": "^3.0.0-rc.11"
},
"author": {
"name": "Lachlan Miller",
Expand Down
10 changes: 2 additions & 8 deletions src/utils/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,8 @@ function findAllVNodes(
}
if (node.suspense) {
// match children if component is Suspense
const { isResolved, fallbackTree, subTree } = node.suspense
if (isResolved) {
// if the suspense is resolved, we match its children
aggregateChildren(nodes, subTree.children)
} else {
// otherwise we match its fallback tree
aggregateChildren(nodes, fallbackTree.children)
}
const { activeBranch } = node.suspense
aggregateChildren(nodes, [activeBranch])
}
if (matches(node, selector) && !matchingNodes.includes(node)) {
matchingNodes.push(node)
Expand Down
164 changes: 82 additions & 82 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.9.4.tgz#68a35e6b0319bbc014465be43828300113f2f2e8"
integrity sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA==

"@babel/parser@^7.10.4":
version "7.10.5"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.10.5.tgz#e7c6bf5a7deff957cec9f04b551e2762909d826b"
integrity sha512-wfryxy4bE1UivvQKSQDU4/X6dr+i8bctjUjj8Zyt3DQy7NtPizJXT8M52nqpNKL+nq2PW8lxk4ZqLj0fD4B4hQ==
"@babel/parser@^7.11.5":
version "7.11.5"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.11.5.tgz#c7ff6303df71080ec7a4f5b8c003c58f1cf51037"
integrity sha512-X9rD8qqm695vgmeaQ4fvz/o3+Wk4ZzQvSHkDBgpYKxpD4qTAUm88ZKtHkVqIOsYFFbIQ6wQYhC6q7pjqVK0E0Q==

"@babel/plugin-proposal-async-generator-functions@^7.8.3":
version "7.8.3"
Expand Down Expand Up @@ -774,10 +774,10 @@
lodash "^4.17.13"
to-fast-properties "^2.0.0"

"@babel/types@^7.10.4":
version "7.10.5"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.10.5.tgz#d88ae7e2fde86bfbfe851d4d81afa70a997b5d15"
integrity sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==
"@babel/types@^7.11.5":
version "7.11.5"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.11.5.tgz#d9de577d01252d77c6800cee039ee64faf75662d"
integrity sha512-bvM7Qz6eKnJVFIn+1LPtjlBFPVN5jNDc1XmN15vWe7Q3DPBufWWsLiIvUu7xW87uTG6QoggpIDnUgLQvPheU+Q==
dependencies:
"@babel/helper-validator-identifier" "^7.10.4"
lodash "^4.17.19"
Expand Down Expand Up @@ -1207,83 +1207,83 @@
dependencies:
"@types/yargs-parser" "*"

"@vue/compiler-core@3.0.0-rc.10":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.0-rc.10.tgz#a76f713fb0462429ec0ec10a472fff1f539c5772"
integrity sha512-kQzHzRsM0NPAWHeqSTb2J4VsHhjRkGeLTsGzeMnW+sojgTnS3T94KacwvYgVS4qeZAKiDq0bMNZoJWrHVQ3T8g==
"@vue/compiler-core@3.0.0-rc.11":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.0-rc.11.tgz#4fb60aeab0b8e560fe4e587b02a546a5ad575754"
integrity sha512-mt4hiJG7BiKo5nbDAZ6Yd9yim2hBIorB5wVWD9bfM5rPbzpwnKp/f8MRlCvLuIjgf43xPbSW6AZ5awrgV1NDsg==
dependencies:
"@babel/parser" "^7.10.4"
"@babel/types" "^7.10.4"
"@vue/shared" "3.0.0-rc.10"
"@babel/parser" "^7.11.5"
"@babel/types" "^7.11.5"
"@vue/shared" "3.0.0-rc.11"
estree-walker "^2.0.1"
source-map "^0.6.1"

"@vue/compiler-dom@3.0.0-rc.10":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.0.0-rc.10.tgz#dd1380d1ee61170de76f9eb91e0d8ac7985f0ae0"
integrity sha512-pqIUf5leZm0P9379utrRSVBMxhV8XaqJTEFFp5etCtbEa/H5ALs29EjFMtMcm9sQaVkZlKLu86mgIacbYB9Q3w==
dependencies:
"@vue/compiler-core" "3.0.0-rc.10"
"@vue/shared" "3.0.0-rc.10"

"@vue/compiler-sfc@^3.0.0-rc.10":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.0.0-rc.10.tgz#4351ece66cdf4d758877482f69421c43d994dbaf"
integrity sha512-VIJ+VXqeM7WoRNgD9uYSARVb6CYq+JS2NNHfeerfNc7Uk3pjYHRv1MwEicAvN6zWFm5GLC1ZYTVD+WFg3xGAkQ==
dependencies:
"@babel/parser" "^7.10.4"
"@babel/types" "^7.10.4"
"@vue/compiler-core" "3.0.0-rc.10"
"@vue/compiler-dom" "3.0.0-rc.10"
"@vue/compiler-ssr" "3.0.0-rc.10"
"@vue/shared" "3.0.0-rc.10"
consolidate "^0.15.1"
"@vue/compiler-dom@3.0.0-rc.11":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.0.0-rc.11.tgz#f991bba3d312e58b80927454e42d2e75adae186f"
integrity sha512-bifgoi7/6E8F5ur9EC/7lFIXC1sUYXi9MzlOpj/VT8UVNN6Ww+2E0EImq4ZpDkZhXNkLfY7yIQIRkIE4SgcG0Q==
dependencies:
"@vue/compiler-core" "3.0.0-rc.11"
"@vue/shared" "3.0.0-rc.11"

"@vue/compiler-sfc@^3.0.0-rc.11":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.0.0-rc.11.tgz#bea07c12c5985ed97e744af1b0461169e7501a60"
integrity sha512-5rNbRiY9pG/govbwv53Y5PcL5qZRDv6twz7Nmap+hfo06u/yhjFmMeU6ftulc6fu/u/hpePVu4rrthFrmOj3hg==
dependencies:
"@babel/parser" "^7.11.5"
"@babel/types" "^7.11.5"
"@vue/compiler-core" "3.0.0-rc.11"
"@vue/compiler-dom" "3.0.0-rc.11"
"@vue/compiler-ssr" "3.0.0-rc.11"
"@vue/shared" "3.0.0-rc.11"
consolidate "^0.16.0"
estree-walker "^2.0.1"
hash-sum "^2.0.0"
lru-cache "^5.1.1"
magic-string "^0.25.7"
merge-source-map "^1.1.0"
postcss "^7.0.27"
postcss-modules "^3.1.0"
postcss "^7.0.32"
postcss-modules "^3.2.2"
postcss-selector-parser "^6.0.2"
source-map "^0.6.1"

"@vue/compiler-ssr@3.0.0-rc.10":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.0.0-rc.10.tgz#95a5f6b65b19a514c94f056994ec144b3b1b03ae"
integrity sha512-JBPil8sO5j7puB8acX2CQMRXEYB/EP8PoEur7RcF/+aqATI7C4yqWcSLC5TRJpigj6xE6ku6sx8om+j7ZHvgBw==
"@vue/compiler-ssr@3.0.0-rc.11":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.0.0-rc.11.tgz#b88df800c890de939955d6e620c7a1316a89b763"
integrity sha512-QXPR+68M5aU1Y5fwwbbvA467cPGmN7xZPRrcjenL1g1gD7q2Xx+dpJsuai7eS625hphFLuJ9SVqQXzk9ANSLwg==
dependencies:
"@vue/compiler-dom" "3.0.0-rc.10"
"@vue/shared" "3.0.0-rc.10"
"@vue/compiler-dom" "3.0.0-rc.11"
"@vue/shared" "3.0.0-rc.11"

"@vue/reactivity@3.0.0-rc.10":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.0.0-rc.10.tgz#34d5f51bcc5a7c36e27d7a9c1bd7a3d25ffa7c56"
integrity sha512-mkUZfOJlbqGZx2cARmhCs5r2+xLJPL7VFNagmlA3Fd66ZXBc3ZvTQdYsY4VUbYJFe5ByIzqu9TZiAkzXY+JVaA==
"@vue/reactivity@3.0.0-rc.11":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.0.0-rc.11.tgz#e3a856f2e4e7ebbd7050b2ef71997c91e3a28a40"
integrity sha512-dlnCZdv4rKm6z4szfaua0Hsd5LQeUeZi6BI5c9Y+CBRU1Dwo8wb9Sz3I42ZRKDrkxB2ii9WhprW4d4H50RCnCA==
dependencies:
"@vue/shared" "3.0.0-rc.10"
"@vue/shared" "3.0.0-rc.11"

"@vue/runtime-core@3.0.0-rc.10":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.0.0-rc.10.tgz#9055aef5113cbc328aaec29760c2151e0ed3cf40"
integrity sha512-VK/kq4gDDoqZ45CVwdbLLpikXLYLCt6YLhdgXX3fhf20gvPqrbEZv1ZNLruNnhhTpf9cLyU4tZ18DHeaUYPziw==
"@vue/runtime-core@3.0.0-rc.11":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.0.0-rc.11.tgz#6fade3a5d7ceed6a61683e375855bf452ce9d301"
integrity sha512-xsnvPoq7jPFuZ8Lo2jWpsPdZh3HyQjAmk5scBD7HycqtuP9m4sB/buGGll4ixBC+VnYyvQqTcCibUlNHFTgk7g==
dependencies:
"@vue/reactivity" "3.0.0-rc.10"
"@vue/shared" "3.0.0-rc.10"
"@vue/reactivity" "3.0.0-rc.11"
"@vue/shared" "3.0.0-rc.11"

"@vue/runtime-dom@3.0.0-rc.10":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.0.0-rc.10.tgz#50f95cb991483a4262163723320967ad17bb321f"
integrity sha512-bH4GuneHt3FQ+/21jba5orM/CO9N1cnT7J3wtrxopFJ4/4H5cvHXyG6v+ZVTu1d733Ij/6yMRA7xbtfi9a4zJw==
"@vue/runtime-dom@3.0.0-rc.11":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.0.0-rc.11.tgz#3700e1f95b822cb6bf9a01c8cd389ae3d54af64c"
integrity sha512-BkRhfJLZN0v7fTntaQ99U3d56VnUUXwfBwAunw5bj/WdS873i+l3AaUBLL41N8gRL3OBrDCiGl/JOsi6h/PISQ==
dependencies:
"@vue/runtime-core" "3.0.0-rc.10"
"@vue/shared" "3.0.0-rc.10"
"@vue/runtime-core" "3.0.0-rc.11"
"@vue/shared" "3.0.0-rc.11"
csstype "^2.6.8"

"@vue/shared@3.0.0-rc.10":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.0.0-rc.10.tgz#e7ab62abcabbfc738545902b96a3aa78f59f3286"
integrity sha512-fI6gVhhgb3cAmEkY4oeVVA2hWZ2xvkgogHdBI5PL7gSvZnOB6XZ2eQGsYjC4W+7BegvEkoMBuZsFXVa4ZQ07XQ==
"@vue/shared@3.0.0-rc.11":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.0.0-rc.11.tgz#9fea645d316771c04874b0f4c493c77609c09aea"
integrity sha512-ys6eRLHxkMM/uEqi/UfeA/AUOmjsJ9AX21WGO2OIAm0v5zDmztjZ+rgcqz8Pgrr+odHY0egOIqc9wOeNtfuMJA==

abab@^2.0.0, abab@^2.0.3:
version "2.0.3"
Expand Down Expand Up @@ -1609,7 +1609,7 @@ big.js@^5.2.2:
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==

bluebird@^3.1.1:
bluebird@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
Expand Down Expand Up @@ -1946,12 +1946,12 @@ configstore@^3.0.0:
write-file-atomic "^2.0.0"
xdg-basedir "^3.0.0"

consolidate@^0.15.1:
version "0.15.1"
resolved "https://registry.yarnpkg.com/consolidate/-/consolidate-0.15.1.tgz#21ab043235c71a07d45d9aad98593b0dba56bab7"
integrity sha512-DW46nrsMJgy9kqAbPt5rKaCr7uFtpo4mSUvLHIUbJEjm0vo+aY5QLwBUq3FK4tRnJr/X0Psc0C4jf/h+HtXSMw==
consolidate@^0.16.0:
version "0.16.0"
resolved "https://registry.yarnpkg.com/consolidate/-/consolidate-0.16.0.tgz#a11864768930f2f19431660a65906668f5fbdc16"
integrity sha512-Nhl1wzCslqXYTJVDyJCu3ODohy9OfBMB5uD2BiBTzd7w+QY0lBzafkR8y8755yMYHAaMD4NuzbAw03/xzfw+eQ==
dependencies:
bluebird "^3.1.1"
bluebird "^3.7.2"

convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0:
version "1.7.0"
Expand Down Expand Up @@ -4719,10 +4719,10 @@ postcss-modules-values@^3.0.0:
icss-utils "^4.0.0"
postcss "^7.0.6"

postcss-modules@^3.1.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/postcss-modules/-/postcss-modules-3.2.0.tgz#1ca870d197cd09a7964253e12de2aac906c94256"
integrity sha512-ceodlVbBypGD3R7EI1xM7gz28J0syaXq0VKd7rJVXVlOSkxUIRBRJQjBgpoKnKVFNAcCjtLVgZqBA3mUNntWPA==
postcss-modules@^3.2.2:
version "3.2.2"
resolved "https://registry.yarnpkg.com/postcss-modules/-/postcss-modules-3.2.2.tgz#ee390de0f9f18e761e1778dfb9be26685c02c51f"
integrity sha512-JQ8IAqHELxC0N6tyCg2UF40pACY5oiL6UpiqqcIFRWqgDYO8B0jnxzoQ0EOpPrWXvcpu6BSbQU/3vSiq7w8Nhw==
dependencies:
generic-names "^2.0.1"
icss-replace-symbols "^1.1.0"
Expand All @@ -4748,7 +4748,7 @@ postcss-value-parser@^4.0.0:
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz#443f6a20ced6481a2bda4fa8532a6e55d789a2cb"
integrity sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==

postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.27, postcss@^7.0.32, postcss@^7.0.5, postcss@^7.0.6:
postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.32, postcss@^7.0.5, postcss@^7.0.6:
version "7.0.32"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.32.tgz#4310d6ee347053da3433db2be492883d62cec59d"
integrity sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==
Expand Down Expand Up @@ -5968,14 +5968,14 @@ vue-router@^4.0.0-alpha.14:
resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-4.0.0-alpha.14.tgz#4bc5fed1db61b8d04fd95ad9c499c7428f039a0e"
integrity sha512-ydWSXxXAsTCiJ31V4x4ZAKI1CdpPMhf7b2LPi4AmG5SCgduu1zf+LhzWWHXmgbmheEiJpfecigVIZp4ABpZJmw==

vue@^3.0.0-rc.10:
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/vue/-/vue-3.0.0-rc.10.tgz#31298a757b4fad6ee8973d0fa27c4fde8574bd01"
integrity sha512-nRsyIQtOWLDMBb5dsPwg/WdIqznCMVWN6O6wJSzhseKC768wHlZKcJ7SPHhWPid9wi3Ykhtl9vtgvxTK/qICkw==
vue@^3.0.0-rc.11:
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/vue/-/vue-3.0.0-rc.11.tgz#c383e74262a51f6bcffd8da9b2049db617533000"
integrity sha512-5Hbgf5c17gZvKXxxwYXL3Xsf+IsknQMiNoKCf/JcS2OvzUdiwRrlu/Pk2kNFPxD/EGX7k1+OTPWUxoq5Aq55ow==
dependencies:
"@vue/compiler-dom" "3.0.0-rc.10"
"@vue/runtime-dom" "3.0.0-rc.10"
"@vue/shared" "3.0.0-rc.10"
"@vue/compiler-dom" "3.0.0-rc.11"
"@vue/runtime-dom" "3.0.0-rc.11"
"@vue/shared" "3.0.0-rc.11"

vuex@^4.0.0-beta.1:
version "4.0.0-beta.1"
Expand Down

0 comments on commit 153f0e8

Please sign in to comment.