You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
method to capture the data from wire @wire(getRecord, {...props}) setSomeRecord(recordData) { this.setWire('some record', recordData); }
method to get the data from storage this.getWire('some record') => Promise
Solution
classA{contactRecordTypeId;
@wire(getObjectInfo,{objectApiName: CONTACT})setContactData(response){this.setWire("WIRE_CONTACT",response);}
@wire(getCurrentPageRef)setPageRef(ref){this.setWire("PAGE_REF",ref);}
@wire(getPicklistOptions,{fieldApiName: CONTACT_TYPE,recordTypeId: "$contactRecordTypeId")setPicklist(response){this.setWire("WIRE_PICKLIST",response);}asyncinit(){constcontactData=awaitthis.getWire("WIRE_CONTACT");this.contactRecordTypeId=contactDdata.defaultRecordTypeId;constpageRef=awaitthis.getWire("PAGE_REF");constpicklistOptions=awaitthis.getWire("WIRE_PICKLIST");// now you can operate there with all data you need}}
PREVIOUS Solution draft
classA{someProp;
@wire(getSomeProp)setSomeProp({data, error}){// proto for "setSomeRecord"if(data){this.someProp=data;this.somePropAwaitList.forEach(([resolve])=>resolve(this.someProp));}if(error){this.somePropAwaitList.forEach(([resolve,reject])=>reject(error));console.error(error);}}somePropAwaitList=[];awaitSomeProp=()=>{// proto for "getWired"if(this.someProp!==undefined){returnPromise.resolve(this.someProp);}else{returnnewPromise((resolve,reject)=>{this.somePropAwaitList=[...this.somePropAwaitList,[resolve,reject]];});}}}
API
WirePromiseMixin
@wire(getRecord, {...props}) setSomeRecord(recordData) { this.setWire('some record', recordData); }
this.getWire('some record') => Promise
Solution
PREVIOUS Solution draft
Source
JackVeromeev/sldt#8
The text was updated successfully, but these errors were encountered: