I have a Smart View that needs to filter out some initial records before showing them to the template. I have tried to use fetchData as was described in the Smart View documents, but not having any luck.
Here’s how I’d imagine it should work:
@service store;
constructor () {
    super(...arguments);
    set(this, "isLoading", true);
    set(this, "currentRecordIsLoading", true);
  }
 async fetchData() {
    set(this, "isLoading", true);
    const params = {
      'page[number]': 1,
      'page[size]': 500
    };
    // get all the talent queues
    await this.store.query('forest_talentQueue', params)
      .then((talentQueues) => {
        // only return TQ if it has a beacon
        talentQueues.filter((talentQueue) => {
          const currentBeacon = talentQueue["forest-Beacons"]?.firstObject || {};
          if (currentBeacon.id !== undefined) {
            talentQueue.beacon = currentBeacon;
            return talentQueue;
          }
        });
        this.set('records', talentQueues);
      });
  }
Basically, I want to only show all the records that have a beacon attached to them, and then use that the initial this.args.records. Is this not possible?
If not, then how can I fetch the filtered data without causing a render on the template?
In my template, I need to:
- show a loading state while the filter records get found:
<div class="wrapper"  {{did-insert this.setDefaultTalentQueue}}>
  {{#if (or this.isLoading @isLoading)}}
    <div class="wrapper--is-loading">
      <span class="fa fa-spinner fa-spin fa-5x"></span>
    </div>
  {{else}}
    <div class="wrapper__list">
      <div class="wrapper__list-inner">
        {{#each this.records as |talentQueue|}}
- 
setDefaultTalentQueueshould select the first record after the filtered records load.
Hope this makes sense. Thanks!
