function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SUMAN KUMARI 70SUMAN KUMARI 70 

Lightning web coponents superbadge challenge

Hi All, 

I am in my 4th challenge of lwc superbadge. Somehow I am not able to complete it. I am getting the following error:

Challenge Not yet complete... here's what's wrong:
We can’t find the return set properly in the boatTypes function in the component boatSearchForm JavaScript file. Make sure the component was created according to the requirements, including the right labels and values to populate the searchOptions, and the proper case-sensitivity.


Please find my code below and let me know where I am going wrong:-
<template>
    <lightning-layout horizontal-align="center">
      <lightning-layout-item class="slds-align-middle">
        <lightning-combobox class="slds-align-middle"
        name="boatTypes"
        value={selectedBoatTypeId}
                onchange={handleSearchOptionChange}
                options={searchOptions}></lightning-combobox>
                
      </lightning-layout-item>
    </lightning-layout>
  </template>
 
import { LightningElement, track, wire } from "lwc";
import getBoatTypes from "@salesforce/apex/BoatDataService.getBoatTypes";

export default class BoatSearchForm extends LightningElement {
  selectedBoatTypeId = "";

  // Private
  @track error = undefined;
  @track searchOptions;
  @track selectedBoatTypeId = "";

  // Wire a custom Apex method
  @wire(getBoatTypes)
  boatTypes({ error, data }) {
    if (data) {
      this.searchOptions = data.map((type) => {
        return {
          label: type.Name,
          value: type.Id
        };
      });
      this.searchOptions.unshift({ label: "All Types", value: "" });
    } else if (error) {
      this.searchOptions = undefined;
      this.error = error;
    }
  }

  // Fires event that the search option has changed.
  // passes boatTypeId (value of this.selectedBoatTypeId) in the detail
  handleSearchOptionChange(event) {
    // Create the const searchEvent
    // searchEvent must be the new custom event search
    event.preventDefault();
    this.selectedBoatTypeId = event.detail.value;
    const searchEvent = new CustomEvent("search", {
      detail: {
        boatTypeId: this.selectedBoatTypeId
      }
    });
    this.dispatchEvent(searchEvent);
  }
}

 
AbhishekAbhishek (Salesforce Developers) 
Hi,

We have a dedicated team for Trailhead guidance & issues please report it here,

https://trailhead.salesforce.com/help?support=home#

https://trailhead.salesforce.com/help

So that our trailhead support engineers will look into it and get back to you.

I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Regards,
Salesforce Support.