Skip to content

Refreshing Components #70

Answered by KevinBatdorf
usernotnull asked this question in Q&A
Discussion options

You must be logged in to vote

If I understand correctly:

That error triggers occurs when the component you are trying to connect to doesn't exist.

It's just a simple selector though (Line 31).

document.querySelector(`[x-data][x-id="${componentName}"], [x-data]#${componentName}`)

To avoid it, you should add probably only use $component() when you know the element will be there, or otherwise add in your own check first to make sure it's there. I think you could do a try/catch and just ignore the error. It's not an expensive operation.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@usernotnull
Comment options

@KevinBatdorf
Comment options

@usernotnull
Comment options

@KevinBatdorf
Comment options

Answer selected by usernotnull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants