-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
445 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# apex-import | ||
|
||
Using Apex in LWC Offline-enabled mobile apps requires additional considerations to ensure proper functioning in offline scenarios. | ||
|
||
When a client device is offline, Apex-based features can read data that was cached while online, but changes (writing data) can’t be saved back to the server. Nor can a change via Apex methods be enqueued as a draft into the Offline Queue. A Lightning web component that uses Apex must be prepared to handle a network connection error as a normal response, for both reading and writing operations. | ||
|
||
See [Use Apex While Mobile and Offline](https://developer.salesforce.com/docs/atlas.en-us.mobile_offline.meta/mobile_offline/apex.htm) for more details. | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# no-aggregate-query-supported | ||
|
||
This rule flags the use of aggregate queries with GraphQL. Currently, aggregate queries with GraphQL are not supported for offline use cases. | ||
|
||
See [Feature Limitations of Offline GraphQL | ||
](https://developer.salesforce.com/docs/atlas.en-us.mobile_offline.meta/mobile_offline/use_graphql_limitations.htm) for more details. | ||
|
||
## ❌ Incorrect | ||
|
||
```GraphQL | ||
query AvgOpportunityExample { | ||
uiapi { | ||
aggregate { | ||
Opportunity { | ||
edges { | ||
node { | ||
aggregate { | ||
Amount { | ||
avg { | ||
value | ||
displayValue | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# no-fiscal-date-filtering-supported | ||
|
||
This rule flags filters that use fiscal date literals and ranges with GraphQL. Currently, filters that use fiscal date literals and ranges with GraphQL are not supported for offline use cases. | ||
|
||
See [Feature Limitations of Offline GraphQL | ||
](https://developer.salesforce.com/docs/atlas.en-us.mobile_offline.meta/mobile_offline/use_graphql_limitations.htm) for more details. | ||
|
||
## ❌ Incorrect | ||
|
||
```GraphQL | ||
{ | ||
uiapi { | ||
query { | ||
Account( | ||
where: { | ||
LastActivityDate: { | ||
eq: { literal: { THIS_FISCAL_YEAR } } | ||
} | ||
} | ||
) { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
``` | ||
|
||
## ✅ Correct | ||
|
||
```GraphQL | ||
{ | ||
uiapi { | ||
query { | ||
Account( | ||
where: { | ||
LastActivityDate: { | ||
eq: { literal: { THIS_YEAR } } | ||
} | ||
} | ||
) { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# no-more-than-1-parent-record | ||
|
||
This rule flags queries that fetch child entities fetching more than 1 parent record with GraphQL. To resolve this error, set the parent's 'first' argument value to 1. | ||
|
||
See [Feature Limitations of Offline GraphQL | ||
](https://developer.salesforce.com/docs/atlas.en-us.mobile_offline.meta/mobile_offline/use_graphql_limitations.htm) for more details. | ||
|
||
## ❌ Incorrect | ||
|
||
```GraphQL | ||
query { | ||
uiapi { | ||
Account(first: 100) { | ||
edges { | ||
node { | ||
Id | ||
Contacts { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
``` | ||
|
||
|
||
## ✅ Correct | ||
|
||
```GraphQL | ||
query { | ||
uiapi { | ||
Account(first: 1) { | ||
edges { | ||
node { | ||
Id | ||
Contacts { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# no-more-than-3-child-entities | ||
|
||
This rule flags queries that fetch more than 3 child entities. To resolve this error, do not fetch more than 3 child entities. | ||
|
||
See [Feature Limitations of Offline GraphQL | ||
](https://developer.salesforce.com/docs/atlas.en-us.mobile_offline.meta/mobile_offline/use_graphql_limitations.htm) for more details. | ||
|
||
## ❌ Incorrect | ||
|
||
```GraphQL | ||
query { | ||
uiapi { | ||
Account(first: 1) { | ||
edges { | ||
node { | ||
Id | ||
Contacts { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
Opportunities { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
Cases { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
Documents { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
``` | ||
|
||
## ✅ Correct | ||
|
||
```GraphQL | ||
query { | ||
uiapi { | ||
Account(first: 1) { | ||
edges { | ||
node { | ||
Id | ||
Contacts { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
Opportunities { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
Cases { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# no-more-than-3-root-entities | ||
|
||
This rule flags queries that fetch more than 3 root entities. To resolve this error, do not fetch more than 3 root entities. | ||
|
||
See [Feature Limitations of Offline GraphQL | ||
](https://developer.salesforce.com/docs/atlas.en-us.mobile_offline.meta/mobile_offline/use_graphql_limitations.htm) for more details. | ||
|
||
|
||
## ❌ Incorrect | ||
|
||
```GraphQL | ||
uiapi { | ||
query { | ||
Contacts { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
Opportunities { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
Cases { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
Documents { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
``` | ||
|
||
## ✅ Correct | ||
|
||
```GraphQL | ||
uiapi { | ||
query { | ||
Contacts { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
Opportunities { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
Cases { | ||
edges { | ||
node { | ||
Id | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# no-mutation-supported | ||
|
||
This rule flags the use of mutations (data modification) with GraphQL. Currently, mutations with GraphQL are not supported for offline use cases. | ||
|
||
See [Feature Limitations of Offline GraphQL | ||
](https://developer.salesforce.com/docs/atlas.en-us.mobile_offline.meta/mobile_offline/use_graphql_limitations.htm) for more details. | ||
|
||
## ❌ Incorrect | ||
|
||
```GraphQL | ||
mutation AccountExample { | ||
uiapi { | ||
AccountCreate(input: { Account: { Name: "Trailblazer Express" } }) { | ||
Record { | ||
Id | ||
Name { | ||
value | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
``` | ||
|
||
## ✅ Correct | ||
|
||
```GraphQL | ||
query accountQuery { | ||
uiapi { | ||
query { | ||
Account { | ||
edges { | ||
node { | ||
Id | ||
Name { | ||
value | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
``` |
Oops, something went wrong.