SmartField not displaying in list view, but do in details

Feature(s) impacted

Displaying and exporting data from a collection

Observed behavior

Certain SmartFields do not render any data on the list view, it’s just an empty column cell. When you click into the record, the data is there. Then clicking back to the list, only then does the data appears on that one row. It’s almost as if it’s lazy loading them on the list view and doesn’t actually fetch the data until you go to the individual record?

SmartField decleration on model:

    public function artistTelephone(): SmartField
    {
        return $this->smartField(['type' => 'String'])->get(fn() => 
               $this->artist != null ? $this->artist->telephone : 'No artist attached' 
        );
    }

Expected behavior

The SmartField columns display in their entirity on the listing, without having to click into the record and back again.

Context

  • Project name:
  • Team name: …
  • Environment name: … production
  • Agent (forest package) name & version: 1.2.3
  • Database type: … mysql
  • Recent changes made on your end if any: …

Hi @EFGP,

You are using the PhP agent, correct ?
Could you also share you Project name please :pray: ?

Could you share the response you get when retrieving the list of records ? I’m particuraly interested in that smart field data of course

Hi @EFGP,

I just did a quick test on my end and I’m able to reproduce this issue.

I’ll open a ticket on our end and we will let you know once fixed.

Thanks :pray:

1 Like

Thanks! As a side note this also seems to happen occasionally with smart fields on details views. The dynamic smart fields appear for a second, then dissapear again.

Hi @EFGP,

I just released version 1.2.5 which fixes the initial issue.

For your second issue, It’s strange, let me know if your still have this problem with the new version of agent.

1 Like

Hi @nicolasa,

We’re on the 1.2.5 now and still experiencing this issue. I will DM you a video.

Hi @EFGP,

Has your problem with the artistTelephone smartField been corrected with version 1.2.5?

Regarding your problem in the video, is the uuid field dynamic or is it a column in your table? If the field is dynamic, could you share your function?

Hi - yes sorry the artistTelephone has been fixed now thank you; but the impersonation links are doing the same thing that was doing pre 1.2.5.

The uuid is a column in the database table, so should be inheritly part of the ‘User’ model.

I think I have identified the problem, the uuid field isn’t displayed in the list view, so it isn’t retrieved from the table and its value is null when the smart field is calculated.

Unfortunately, the only way to solve the problem is to refresh the model before returning the calculated value. You could put $this->refresh() at the beginning of the get() closure.