Error on passing variable to partial: can't evaluate field in type *hugolib.pageState

I’ve looked through the other questions on here about passing a variable to a partial, but unfortunately they don’t seem to solve my issue.

In layouts/products/single.html, I have the following:

  {{$desc := slice}}
  {{range (where (where site.RegularPages "Section" "companies") ".Title" "eq" .Params.company)}}
    {{$desc = .Description}}
  {{end}}
  
  {{partial "products/description.html" (dict "context" . "desc" $desc)}}

In partials/products/description:

{{.desc}}

This results in the error: can't evaluate field desc in type *hugolib.pageState.

I don’t understand the error. Can someone please explain what I’m doing wrong?

I’m using v0.61.

My code is correct, but I accidentally made a typo in my question. I’ve updated my post.

Just managed to figure out what the issue is, I think.

I’m calling the same partial multiple times in single.html.

I’m doing so like in my post:

  {{partial "products/description.html" (dict "context" . "desc" $desc)}}

But also later on without passing the variable, like so:

{{partial "products/description.html" .}}

And that’s what’s been causing the issue. An error on my part. Appreciate your help. Thanks.