A component renders an empty card with no error. How do you debug it?
Testing Where you look when there is no error message to read.
A component wired to an Apex method shows its heading and nothing else. No error appears on screen, the browser console is clean, and the same Apex method returns rows when run in Anonymous Apex.
An empty render with a clean console usually means the wire returned an
error and the template has nowhere to put it. So the first thing I would do
is render the error: log both halves of the wire result, or add an
if:true={error} block to the template. If the error turns out to be an
access problem, that also explains why Anonymous Apex works — that runs as
me, and the component runs as whoever is looking at it.
Working in Anonymous Apex and returning nothing in the component is the
most useful clue in the report, because Anonymous Apex runs as an
administrator in system mode. That points at permissions or sharing rather
than the query. I would surface the error first — a wire always gives me
data or error, and a template that only checks data swallows the
second half silently — then read what it says. If it is
INSUFFICIENT_ACCESS, the fix is a permission set, not code. And whatever
the cause, the error branch stays in the template, because the next person
to hit this deserves a message rather than an empty card.
- Does the template guard on
dataalone, or does it also render theerrorbranch when one comes back? - Is the Apex method running as the current user, and does that user have read access to the object?
Add console.log statements through the JavaScript until something shows
up.
The JavaScript is the least likely place for this. A wire that failed
populates error, not data, and a template that only renders when data
is truthy will show exactly this — a heading and nothing else — with no
console output at all. The missing piece is an error branch, not a log.
They'll ask next Why is the console clean if the wire failed?
Because a failed wire is a value, not an exception. Nothing throws — the error lands in the wire result and waits for you to look at it.
They'll ask next What if both data and error are undefined?
Then the wire has not resolved yet, which is a loading state rather than a bug. Rendering a spinner for that case removes the ambiguity.