JS Query Scope - not seeing elements

Hi there

I can't see this issue in another thread but I can't believe I'm the first person to have this struggle.

I have a query that I want to control the behaviour of a certain element based on the state of another. I create a JS query and when it is first created only it can see the elements fine.

As soon as I rename or organise my query into a folder suddenly it can't see my elements at all.

What is happening? My research tells me it's a scope thing but why is renaming my query changing the scope of it? Can I change it back?

My images are in the wrong order but hopefully you see what I mean :upside_down_face:

Hey @LucasT! Welcome to the community.

I definitely see what you mean but I wonder if the linter is just throwing out a false positive. Does the query work as expected despite the message showing that your component/value doesn't exist?

If so, you might just need to refresh your page data so that the newly named query is correctly cached by the browser (it may be cached/linked to the old name for rendering, which wouldn't necessarily update until the whole page did)

I think @pyrrho's suggestion here is probably right on the money, @LucasT! This is most likely just a linting error, meaning you should be able to refresh the page and have everything go back to normal. If that's not the case, let me know and I can investigate further. :+1:

That is correct - the query ran fine despite claiming that it can't see the elements in question. Performance anxiety I reckon.
Thanks very much!

1 Like