-
Notifications
You must be signed in to change notification settings - Fork 88
(DOCSP-26996) Add Realm React support to 'Write Transactions' #2560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(DOCSP-26996) Add Realm React support to 'Write Transactions' #2560
Conversation
Readability for Commit Hash: 2e371f3 You can see any previous Readability scores (if they exist) by looking Flesch Reading Ease scores for changed documents:
The following table can be helpful in assessing the readability score of a document.
|
}) | ||
.. literalinclude:: /examples/generated/react-native/ts/create-test.snippet.crud-create-object.tsx | ||
:language: typescript | ||
:emphasize-lines: 6-8 | ||
|
||
Transaction Lifecycle | ||
--------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit while we're mucking around in here. below, rather than having the note about how transactions work w sync, could you make that either:
- another bullet point
- a sub bullet point
- or just another sentence on this bullet point.
operations in a single, idempotent update. A transaction is | ||
*all or nothing*. Either: | ||
Within a ``<RealmProvider>`` that has an open realm, you can create Realm objects | ||
using a :js-sdk:`Realm.write() transaction block <Realm.html#write>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using a :js-sdk:`Realm.write() transaction block <Realm.html#write>`. | |
using a :js-sdk:`Realm.write() <Realm.html#write>` transaction block. |
usually we just link to the method name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm w a few small suggestions.
transactions let you create, modify, or delete Realm objects. They handle | ||
operations in a single, idempotent update. A transaction is | ||
*all or nothing*. Either: | ||
Within a ``<RealmProvider>`` that has an open realm, you can create Realm objects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Within a ``<RealmProvider>`` that has an open realm, you can create Realm objects | |
Within a ``<RealmProvider>`` that has an open realm, access a realm | |
with the ``useRealm()`` hook. You can create, update, and delete Realm objects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few small things. Otherwise looks good!
transactions let you create, modify, or delete Realm objects. They handle | ||
operations in a single, idempotent update. A transaction is | ||
*all or nothing*. Either: | ||
Within a ``<RealmProvider>`` that has an open realm, you can access a realm with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Within a ``<RealmProvider>`` that has an open realm, you can access a realm with | |
Within a ``<RealmProvider>``, you can access a realm with |
Anything rendered within a RealmProvider will have access to an open realm. If it's closed, then it won't be rendered. Therefore I think we can remove "that has an open realm", as this may lead to confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we should capitalize "Realm"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Thanks, Andrew.
Re: capitalization, we typically only capitalize "Realm" when talking about the product itself. An instance of a realm is lower case. I'm not sure the history of this practice, but I imagine it's to improve readability. We use the latter form a lot in the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
capitalization
Yeah, that sounds logical. As long as you all have a way to keep it consistant throughout the docs, i'm happy 👍🏼
When using :ref:`Sync <sync>`, the SDK also queues | ||
the changes to send to Atlas App Services. The SDK sends | ||
these changes when a network is available. | ||
- When using :ref:`Sync <sync>`, the SDK also queues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth adding a bullet that after a write transaction, any object or collections returned by useQuery
or useObject
will rerender for any relevant changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that's excellent information to add. Thank you!
## Pull Request Info I took this opportunity to bring this page's content in line with the Flutter SDK, as the existing content is hard to follow and overly explanatory. ### Jira - https://jira.mongodb.org/browse/DOCSP-26996 ### Staged Changes - [Write Transactions](https://docs-mongodbcom-staging.corp.mongodb.com/realm/docsworker-xlarge/DOCSP-26996/sdk/react-native/realm-database/write-transactions/) ### Reminder Checklist If your PR modifies the docs, you might need to also update some corresponding pages. Check if completed or N/A. - [x] Create Jira ticket for corresponding docs-app-services update(s), if any - [x] Checked/updated Admin API - [x] Checked/updated CLI reference ### Review Guidelines [REVIEWING.md](https://github.com/mongodb/docs-realm/blob/master/REVIEWING.md)
## Pull Request Info I took this opportunity to bring this page's content in line with the Flutter SDK, as the existing content is hard to follow and overly explanatory. ### Jira - https://jira.mongodb.org/browse/DOCSP-26996 ### Staged Changes - [Write Transactions](https://docs-mongodbcom-staging.corp.mongodb.com/realm/docsworker-xlarge/DOCSP-26996/sdk/react-native/realm-database/write-transactions/) ### Reminder Checklist If your PR modifies the docs, you might need to also update some corresponding pages. Check if completed or N/A. - [x] Create Jira ticket for corresponding docs-app-services update(s), if any - [x] Checked/updated Admin API - [x] Checked/updated CLI reference ### Review Guidelines [REVIEWING.md](https://github.com/mongodb/docs-realm/blob/master/REVIEWING.md)
Pull Request Info
I took this opportunity to bring this page's content in line with the Flutter SDK, as the existing content is hard to follow and overly explanatory.
Jira
Staged Changes
Reminder Checklist
If your PR modifies the docs, you might need to also update some corresponding
pages. Check if completed or N/A.
Review Guidelines
REVIEWING.md