Skip to content

Grammar/spelling polish, MUTATION_OPS as const #22

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion snippets/updating-data/create-record/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { serializeResources } from '@ember-data/json-api/request';

const MUTATION_OPS = new Set(['createRecord', 'updateRecord']);


const updatesHandler = {
request(context, next) {
if (!MUTATION_OPS.has(context.request.op)) {
Expand Down
4 changes: 2 additions & 2 deletions snippets/updating-data/save-record/handler.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Create handler for serialization of any record
import { serializeResources } from '@ember-data/json-api/request';

const updatesHandler = {
MUTATION_OPS: new Set(['createRecord', 'updateRecord']),
const MUTATION_OPS = new Set(['createRecord', 'updateRecord']);

const updatesHandler = {
request(context, next) {
if (!MUTATION_OPS.has(context.request.op)) {
// Not a mutation, do nothing
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/components/guide-section/subsection-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module('Integration | Component | guide-section/subsection', function (hooks) {
assert
.dom('[data-test-field="Subsection Description"]')
.includesText(
'Examples here are shown for apps that use JSON:API. Apps using other paradigms should use the builders for REST or ActiveRecord if applicable, or author their own (or a new community lib!) if not.'
'Examples here are shown for apps that use JSON:API. Apps using other paradigms should use the builders for REST or ActiveRecord if applicable, or author their own (or a new community library!) if not.'
);

const emberClassic = this.element.querySelector(
Expand Down Expand Up @@ -97,7 +97,7 @@ module('Integration | Component | guide-section/subsection', function (hooks) {
assert
.dom('[data-test-field="Subsection Description"]')
.includesText(
'To create a new record using Ember Data you should use createRecord request and attach "body" to it. In case of JSON:API backend - you can use serializeResources request utility.'
'To create a new record using Ember Data, you should use a createRecord request and attach "body" to it. Use the serializeResources request utility when working with a JSON:API backend.'
);

const emberClassic = this.element.querySelector(
Expand Down Expand Up @@ -133,7 +133,7 @@ module('Integration | Component | guide-section/subsection', function (hooks) {
assert
.dom('[data-test-field="Subsection Description"]')
.includesText(
'To delete an existing record using Ember Data you should use deleteRecord builder to issue the request.'
'To delete an existing record using Ember Data, you should use deleteRecord builder to issue the request.'
);

const emberClassic = this.element.querySelector(
Expand Down
2 changes: 1 addition & 1 deletion translations/adapters/path-for-type/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ title: Use request builders instead of pathForType
description: >
To modify a URL for a request you can use the '<code>'resourcePath'</code>' option for every request builder. Default configuration for '<code>'JSON:API'</code>', '<code>'REST'</code>', and '<code>'ActiveRecord'</code>' builders will be provided by EmberData.
<br />
We recommend creating your own utility file with request builders that suite your backend's needs.
We recommend creating your own utility file with request builders that suit your backend's needs.
2 changes: 1 addition & 1 deletion translations/deleting-data/delete-record/en-us.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
title: deleteRecord
description: To delete an existing record using Ember Data you should use <code>deleteRecord</code> builder to issue the request.
description: To delete an existing record using Ember Data, you should use <code>deleteRecord</code> builder to issue the request.
4 changes: 2 additions & 2 deletions translations/fetching-data/find-all/en-us.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
title: findAll
description: |
There is no direct replacement for <code>findAll</code>, you can use <code>query</code> without extra options instead. Here is how to achieve exact <code>findAll</code> behavior:
We discourage using <code>peekAll</code>. When you made a request, you need to guarantee that everything you requested is part of response you get back.
There is no direct replacement for <code>findAll</code>, so you can use <code>query</code> with extra options instead. Here's how to achieve exact <code>findAll</code> behavior:
We discourage using <code>peekAll</code>, but it is currently the best way to guarantee that everything you requested is part of the response you get back.
2 changes: 1 addition & 1 deletion translations/fetching-data/find-record/en-us.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
title: findRecord
description: |
Examples here are shown for apps that use JSON:API. Apps using other paradigms should use the builders for REST or ActiveRecord if applicable, or author their own (or a new community lib!) if not.
Examples here are shown for apps that use JSON:API. Apps using other paradigms should use the builders for REST or ActiveRecord if applicable, or author their own (or a new community library!) if not.
2 changes: 1 addition & 1 deletion translations/fetching-data/query/en-us.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
title: query
description: The <code>query</code> just moved out from being on <code>Store</code> public interface to builders.
description: The <code>query</code> has moved from the <code>Store</code> public interface to builders.
4 changes: 2 additions & 2 deletions translations/serializers/general/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ description: |
<br />
Similarly, the methods '<code>'adapterFor'</code>' and '<code>'serializerFor'</code>' will not be deprecated until at least 6.0; however, it should no longer be assumed that an application has an adapter or serializer at all.
<br />
Serializers previously was used to accomplish two main things: serialization and normalization.
Serializers previously were used to accomplish two main things: serialization and normalization.
<br />
Normalization is now done in handlers, before returning the response.
<br />
Serialization can be done in handler, but we encourage application developers to do it in request builder.
Serialization can be done in a handler, but we encourage application developers to do it in request builder.
2 changes: 1 addition & 1 deletion translations/updating-data/create-record/en-us.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
title: createRecord
description: To create a new record using Ember Data you should use <code>createRecord</code> request and attach <code>"body"</code> to it. In case of JSON:API backend - you can use <code>serializeResources</code> request utility.
description: To create a new record using Ember Data, you should use a <code>createRecord</code> request and attach <code>"body"</code> to it. Use the <code>serializeResources</code> request utility when working with a JSON:API backend.