Nikita Chursin 87bcda1f8e added installation info to readme | 3 years ago | |
---|---|---|
.husky | 3 years ago | |
.vscode | 3 years ago | |
config | 3 years ago | |
force-app | 3 years ago | |
.eslintignore | 3 years ago | |
.forceignore | 3 years ago | |
.gitignore | 3 years ago | |
.prettierignore | 3 years ago | |
.prettierrc | 3 years ago | |
README.md | 3 years ago | |
jest.config.js | 3 years ago | |
package-lock.json | 3 years ago | |
package.json | 3 years ago | |
sfdx-project.json | 3 years ago |
This is a small package that tends to replicate LWC backend APIs that don't support promises.
That is probably the main question you may have if you stumbled across this repo. The main reason is I don't like the @wire
decorator:
isLoading
getter becomes messy.wire
cuase some of our e2e tests go flaky. Probably we just don't know how to cook it here though.getRecord
cannot be promisified. At least I didn't found how to do it :(This is distributed as an unlocked package. Just install the latest version.
Alternatively, you can clone this repo and push/deploy it to your org.
Instead of importing getRecord
from LWC library, you can just use getRecord
from sfcraft_LwcApi
:
import getRecord from '@salesforce/apex/sfcraft_LwcApi.getRecord';
...
async connectedCallback () {
this.record = await getRecord({recordId: this.recordId, fields: ['Id', 'Name' ]});
}