Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vincent15000's avatar

Computed property not working

Hello,

I have several computed properties, but this one doesn't work.

const foundRight = computed(() => {
    return rights.value.find((right) => {
        return (
            right.branch_id === search.branch_id &&
            right.user_id === search.user_id
        );
    });
});

I have added some console log inside the computed function, but it seems to be never evaluated.

What am I doing wrong ?

Thanks for your help.

V

0 likes
6 replies
gych's avatar

Hey, Is search a reactive property? If not make it reactive and test again.

1 like
vincent15000's avatar

@gych Other computed properties work fine with the search variable.

const search = reactive({
    branch_id: null,
    user_id: null,
    role_id: null,
});

Do you have other ideas ?

gych's avatar
gych
Best Answer
Level 29

@vincent15000 I quickly tested your code and it seems to work fine

This is the link of the playground / test scenario I used: Vue Playground

1 like
vincent15000's avatar

@gych Ok thank you ... hmmm strange ... I have to find why it's not evaluated in my component. Thank you ;).

1 like
gych's avatar

@vincent15000 No problem :) Just wondering, did you manage to find what caused it not to work?

1 like
vincent15000's avatar

@gych Oh yes ... sure I was very tired when I wrote the code ... the condition was wrong.

Please or to participate in this conversation.