inertia icon indicating copy to clipboard operation
inertia copied to clipboard

V2: href of Link Component does not update on change

Open NicolasKion opened this issue 11 months ago • 0 comments

Versions:

  • @inertiajs/vue3 version: 2.0.0-beta.2

Describe the problem:

It appears that the Link component does not react to updates of a computed any source href, computed or not

Steps to reproduce:

<script setup>
import {Link} from "@inertiajs/vue3";
import {computed, onMounted, onUnmounted, ref} from "@vue/runtime-core";

const val = ref('test');

// Some arbitrary computed value as source of the href
const href = computed(() => {
    return `/${val.value}`;
});

const iv = ref(0);

/*
    Updating the source of the computed value will also update the computed value
 */
onMounted(() => {
    iv.value = setInterval(() => {
        val.value = 'test' + Math.random();
        console.log(href.value);
    }, 1000);
});

onUnmounted(() => {
    clearInterval(iv.value);
}  );


// The href of the Link never updates from the initial value
</script>
<template>
    <div>
        <Link :href="href">Home</Link>
    </div>
</template>

NicolasKion avatar Oct 31 '24 13:10 NicolasKion