Skip to content

(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

Merged
merged 4 commits into from
Feb 8, 2023

Conversation

krollins-mdb
Copy link
Collaborator

@krollins-mdb krollins-mdb commented Feb 6, 2023

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.

  • Create Jira ticket for corresponding docs-app-services update(s), if any
  • Checked/updated Admin API
  • Checked/updated CLI reference

Review Guidelines

REVIEWING.md

@github-actions
Copy link

github-actions bot commented Feb 6, 2023

Readability for Commit Hash: 2e371f3

You can see any previous Readability scores (if they exist) by looking
at the comment's history.

Flesch Reading Ease scores for changed documents:

  • source/sdk/react-native/realm-database/write-transactions: 59.4

The following table can be helpful in assessing the readability score of a document.

Score Difficulty
90-100 Very Easy
80-89 Easy
70-79 Fairly Easy
60-69 Medium
50-59 Fairly Hard
30-49 Hard
0-29 Very Hard

@krollins-mdb krollins-mdb marked this pull request as ready for review February 6, 2023 21:50
})
.. literalinclude:: /examples/generated/react-native/ts/create-test.snippet.crud-create-object.tsx
:language: typescript
:emphasize-lines: 6-8

Transaction Lifecycle
---------------------
Copy link
Collaborator

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>`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Collaborator

@mongodben mongodben left a 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Collaborator

@takameyer takameyer left a 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Collaborator

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"

Copy link
Collaborator Author

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.

Copy link
Collaborator

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
Copy link
Collaborator

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.

Copy link
Collaborator Author

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!

@krollins-mdb krollins-mdb merged commit 1fe5aaa into mongodb:realm-react-guidance Feb 8, 2023
mongodben pushed a commit that referenced this pull request Feb 10, 2023
## 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)
mongodben pushed a commit that referenced this pull request Mar 21, 2023
## 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)
@krollins-mdb krollins-mdb deleted the DOCSP-26996 branch March 24, 2023 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants