Make search work correctly when clicking on results
This commit is contained in:
parent
31092df5df
commit
201c8a7c4c
2 changed files with 36 additions and 17 deletions
|
@ -18,7 +18,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="mt-6 sidenav mr-6 bg-white border rounded">
|
||||
<router-link :to="{ name: 'server', params: { id: this.$route.params.id } }">
|
||||
<router-link :to="{ name: 'server', params: { id: $route.params.id } }">
|
||||
<terminal-icon class="h-4"></terminal-icon> Console
|
||||
</router-link>
|
||||
<router-link :to="{ name: 'server-files' }">
|
||||
|
@ -51,7 +51,7 @@
|
|||
</div>
|
||||
</div>
|
||||
-->
|
||||
<router-view></router-view>
|
||||
<router-view :key="server.identifier"></router-view>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -87,6 +87,18 @@
|
|||
...mapState('socket', ['connected', 'connectionError']),
|
||||
},
|
||||
|
||||
// Watch for route changes that occur with different server parameters. This occurs when a user
|
||||
// uses the search bar. Because of the way vue-router works, it won't re-mount the server component
|
||||
// so we will end up seeing the wrong server data if we don't perform this watch.
|
||||
watch: {
|
||||
'$route': function (toRoute, fromRoute) {
|
||||
if (toRoute.params.id !== fromRoute.params.id) {
|
||||
this.loadingServerData = true;
|
||||
this.loadServer();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
loadingServerData: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue