[2.x] Upgrade VueJS to version 3#666
Conversation
|
@octoper fyi: this PR won't be reviewed until it's out of draft |
|
Yeah I know that's why I marked it as daft 😅 |
|
cc @driesvints Ready for review! |
|
@octoper can you please fix the StyleCI warnings so everything's green? |
|
@driesvints Done! |
|
@reinink does this look good to you? |
| this.$once('hook:destroyed', () => { | ||
| document.removeEventListener('keydown', closeOnEscape) | ||
| }) | ||
|
|
There was a problem hiding this comment.
So where does this get removed now?
There was a problem hiding this comment.
Whoops totally forgot about that, I will add it tommorow, this hook removed at first because the depreciation of $once function
but this willbe moved in the beforeUnmount lifecycle hook without the $once function
| @@ -1,5 +1,5 @@ | |||
| <template> | |||
| <portal to="modal"> | |||
| <Teleport to="#modal"> | |||
There was a problem hiding this comment.
I haven't tested this, but do you really need the <div id="modal"></div>? I think you can just do to="body". Also, I'm pretty sure even Vue uses the lowercase version of <teleport> in their docs, so that might be more idiomatic.
| <Teleport to="#modal"> | |
| <teleport to="body"> |
| </div> | ||
| </transition> | ||
| </portal> | ||
| </Teleport> |
There was a problem hiding this comment.
| </Teleport> | |
| </teleport> |
|
|
||
| <!-- Modal Teleport --> | ||
| <div id="modal"></div> |
There was a problem hiding this comment.
Not required, as per comment above.
| <!-- Modal Teleport --> | |
| <div id="modal"></div> |
| <jet-label for="terms"> | ||
| <div class="flex items-center"> | ||
| <jet-checkbox name="terms" id="terms" v-model="form.terms" /> | ||
| <jet-checkbox name="terms" id="terms" v-model:checked="form.terms"/> |
There was a problem hiding this comment.
Missing space.
| <jet-checkbox name="terms" id="terms" v-model:checked="form.terms"/> | |
| <jet-checkbox name="terms" id="terms" v-model:checked="form.terms" /> |
src/Console/InstallCommand.php
Outdated
| @@ -269,16 +269,15 @@ protected function installInertiaStack() | |||
| $this->updateNodePackages(function ($packages) { | |||
| return [ | |||
| '@inertiajs/inertia' => '^0.8.2', | |||
There was a problem hiding this comment.
Might be worth bumping this to 0.8.4, given the recent axios vulnerability (see here).
| '@inertiajs/inertia' => '^0.8.2', | |
| '@inertiajs/inertia' => '^0.8.4', |
|
Fixed everything @reinink and @taylorotwell mentioned |
| }, | ||
|
|
||
| unmounted() { | ||
| const closeOnEscape = (e) => { |
There was a problem hiding this comment.
Hmm, does redefining the entire function actually work when removing it? I don't think so. I think you need the reference to the original function to remove it.
Here's what I believe is the proper Vue 3 way to handle this. Remove both the mounted() and unmounted() methods, and then add a new setup() method instead. Something like this:
import { onMounted, onUnmounted } from 'vue'
setup () {
const closeOnEscape = (e) => {
if (this.open && e.keyCode === 27) {
this.open = false
}
}
onMounted(() => document.addEventListener('keydown', closeOnEscape))
onUnmounted(() => document.removeEventListener('keydown', closeOnEscape))
},Again, this is untested, so definitely do test it, but this should work. 👍
|
|
||
| document.addEventListener('keydown', closeOnEscape) | ||
|
|
||
| this.$once('hook:destroyed', () => { |
There was a problem hiding this comment.
However we solve this in the Dropdown.vue component, needs to also be done here.
|
@octoper is this PR ready to go from your perspective now? |
|
Yeah it's ready from me @taylorotwell |
|
when this will be merged? |
|
Thanks! |
|
@taylorotwell will you be tagging a release soon so that this can be used, or should I just target the branch? |
|
@AbdelElrafa releases are always done on Tuesdays. You should only ever target a dev branch for development and not for production releases. |
Upgrade Inertia stack from VueJS v2 to VueJS v3