diff --git a/NEWS.md b/NEWS.md index b1682121..a1783a58 100644 --- a/NEWS.md +++ b/NEWS.md @@ -141,7 +141,7 @@ Fragment auto update is removed as the feature seemed too brittle to use. Instead I'm encouraging users do this by themselves on the front using standard redux reducers. The fragment functionality has been changed to as a way to optionally tag your nodes with information about the partial being used, the -path where the tag occured and the name you give to it. You can use this information to iterate across all your pages in your own reducer.: +path where the tag occurred and the name you give to it. You can use this information to iterate across all your pages in your own reducer.: ``` fragments: [ @@ -219,14 +219,14 @@ your rails initializer to call `Props.reset_encoder!` - `render_collection` like behavior (single lookup for a partial) for `json.array!(partial: 'foobar)'` - Explicit control over node traversal via search options e.g `json.foobar(search:'foobar.posts.id=1')` - Renders `json` instead of `js` -- BreezyJS no longer uses Server Generated Javascript Responses. It uses JSON and is now easier to use your favorite JSON browser plugin to see the JSON version of your page, for example: `localhost:3000/posts.json` +- BreezyJS no longer uses Server Generated JavaScript Responses. It uses JSON and is now easier to use your favorite JSON browser plugin to see the JSON version of your page, for example: `localhost:3000/posts.json` - Breezy Rails controller requirements is simplified, no macros needed just plain Rails, be sure to `rails generate scaffold post` or `rails breezy:install:web` to see what changed. ## v0.12.0 - Update tests for rails 6 - Remove support for rails 4 -- Update gemspec, removed some unneeded dependancies +- Update gemspec, removed some unneeded dependencies - Use JSON.dump instead of MultiJSON - Remove dead comments and methods - Drop pessimistic version constraint @@ -244,7 +244,7 @@ BREAKING CHANGE: Rename `_bz` param to `bzq` - BREAKING CHANGE: All keys `json.my_key_here` in BreezyTemplate will `key_format` to camelCase `{"myKeyHere": 'foobar'}`. This makes working with props received via `mapStateToProps` easier to work with. - FIX: `remote` now merges joints on graft requests - BREAKING CHANGE: `remote` will update all joints before fetching nodes when using deferment. The previous behavior was to update after all deferred fetches were finished, but this caused some issues and confusion around proper behavior. This will be the fix for now. -- NEW: Breezy now dispatches `@@breezy/GRAFTING_ERROR`. This is a listenable action that you can use to retry deferments that fail due to network errors. You will recieve the `pageKey`, the `url` that failed, and the `keyPath` to the missing node. +- NEW: Breezy now dispatches `@@breezy/GRAFTING_ERROR`. This is a listenable action that you can use to retry deferments that fail due to network errors. You will receive the `pageKey`, the `url` that failed, and the `keyPath` to the missing node. - `remote` now has a fallback `pageKey` if one isn't provided. - `ensureSingleVisit`, the function that powers `visit` is now exposed for use. Come in super handy when you want to create your own `visit` function. For example, instaclick functionality. - BREAKING CHANGE: Remove immutable helpers. It doesn't seem like good practice to create immutable action creators, probably doing too much work for the user and makes testing more difficult. Instead recommend and document immmer usage and keep getIn (exported for traversing), and setIn (for internal use) around. diff --git a/docs/deferments.md b/docs/deferments.md index be1adeaf..36c7aef2 100644 --- a/docs/deferments.md +++ b/docs/deferments.md @@ -69,7 +69,7 @@ then immutably grafts that payload into the `/dashboard` page at the path } ``` -Your page component finally recieves the new props and rerenders. For more +Your page component finally receives the new props and rerenders. For more control, you may provide a `success_action` or `fail_action`, and Superglue will dispatch these actions when the promise resolves successfully or fails. diff --git a/docs/fragments.md b/docs/fragments.md index 4bd6db30..43a0d1d5 100644 --- a/docs/fragments.md +++ b/docs/fragments.md @@ -164,4 +164,4 @@ update(toFragmentRef('userCart'), (cartDraft) => { }) ``` -In the example, you recieve an immer draft of the fragment and you can mutate it however you want. +In the example, you receive an immer draft of the fragment and you can mutate it however you want. diff --git a/docs/index.md b/docs/index.md index 6ecff353..81c23660 100644 --- a/docs/index.md +++ b/docs/index.md @@ -26,7 +26,7 @@ And of course, batteries are included: Turbo Streams [ported](./super-turbo-streams.md) for Superglue and React. Use `broadcast_append_to` and more to easily update your UI. -- **Unobtrusive Javascript (UJS)** +- **Unobtrusive JavaScript (UJS)** [Bringing back](ujs.md) a classic to make developing SPA features easy and familiar diff --git a/docs/recipes/spa-pagination.md b/docs/recipes/spa-pagination.md index d24e36ed..54875b76 100644 --- a/docs/recipes/spa-pagination.md +++ b/docs/recipes/spa-pagination.md @@ -211,7 +211,7 @@ user, only the posts list changes, but the header stays the same. !!! info In effect, this achieves the same functionality as [Turbo Frames], but -Superglue leans more on Unobtrusive Javascript for better ergonomics. +Superglue leans more on Unobtrusive JavaScript for better ergonomics. [Turbo Frames]: https://turbo.hotwired.dev/handbook/frames diff --git a/docs/redux-state-shape.md b/docs/redux-state-shape.md index e3c7753b..b44c6f1d 100644 --- a/docs/redux-state-shape.md +++ b/docs/redux-state-shape.md @@ -42,7 +42,7 @@ both as `/posts`. ### `fragments` [Fragments](./fragments.md) are rendered Rails partials with an identity. They're created when a -response is recieved. Superglue takes the payload and [denormalizes](./fragments.md#denormalization) it into +response is received. Superglue takes the payload and [denormalizes](./fragments.md#denormalization) it into fragments and fragment refs. ```js diff --git a/docs/reference/types.md b/docs/reference/types.md index beddd139..1e5d585b 100644 --- a/docs/reference/types.md +++ b/docs/reference/types.md @@ -161,7 +161,7 @@ The root state for a Superglue application. It occupies | Property | Type | Description | Defined in | | ------------------------------------ | ----------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | `superglue` | [`SuperglueState`](#supergluestate) | Contains readonly metadata about the current page | [types/index.ts:371](https://github.com/thoughtbot/superglue/blob/38ea0f22384ca668ffa28ead0054dc09a0f39366/superglue/lib/types/index.ts#L371) | -| `pages` | [`AllPages`](#allpages)\<`T`\> | Every [PageResponse](#pageresponse) that superglue recieves is stored here. | [types/index.ts:373](https://github.com/thoughtbot/superglue/blob/38ea0f22384ca668ffa28ead0054dc09a0f39366/superglue/lib/types/index.ts#L373) | +| `pages` | [`AllPages`](#allpages)\<`T`\> | Every [PageResponse](#pageresponse) that superglue receives is stored here. | [types/index.ts:373](https://github.com/thoughtbot/superglue/blob/38ea0f22384ca668ffa28ead0054dc09a0f39366/superglue/lib/types/index.ts#L373) | | `fragments` | [`AllFragments`](#allfragments) | - | [types/index.ts:374](https://github.com/thoughtbot/superglue/blob/38ea0f22384ca668ffa28ead0054dc09a0f39366/superglue/lib/types/index.ts#L374) | | `flash` | [`FlashState`](#flashstate) | - | [types/index.ts:375](https://github.com/thoughtbot/superglue/blob/38ea0f22384ca668ffa28ead0054dc09a0f39366/superglue/lib/types/index.ts#L375) | diff --git a/docs/reference/types.requests.md b/docs/reference/types.requests.md index e65db174..b7f39d66 100644 --- a/docs/reference/types.requests.md +++ b/docs/reference/types.requests.md @@ -137,7 +137,7 @@ Defined in: [types/requests.ts:133](https://github.com/thoughtbot/superglue/blob A callback that fires in between recieving a payload and saving a payload. Use this callback to modify the payload before it gets saved. Its -useful for appending, prepending, shuffeling, etc. recieved data to +useful for appending, prepending, shuffeling, etc. received data to existing data. `prevPage` is `undefined` when there is no existing page in the store diff --git a/docs/requests.md b/docs/requests.md index 55ea7538..5e66a59d 100644 --- a/docs/requests.md +++ b/docs/requests.md @@ -1,6 +1,6 @@ # Requests -If you prefer to navigate using Javascript, or need more functionality than what UJS +If you prefer to navigate using JavaScript, or need more functionality than what UJS offers, Superglue comes with two functions built around `fetch`, `visit` and `remote`. These are wrapped with your own implementation in [application_visit.js] and can be accessed via the [NavigationContext]. diff --git a/docs/shaping.md b/docs/shaping.md index 26c47c73..101fbd81 100644 --- a/docs/shaping.md +++ b/docs/shaping.md @@ -67,7 +67,7 @@ transform data, do it on the server side. Superglue encourages you to shape UI state on the server because -1. Ruby combined with Rails view heleprs is just as good, if not better, than Javascript at shaping state for React components. +1. Ruby combined with Rails view heleprs is just as good, if not better, than JavaScript at shaping state for React components. 2. UI patterns are universal - headers, footers, a body with a list of items exist in every app. Business logic varies wildly, but these presentational structures remain constant. This creates immediate intuition; a developer can easily guess the shape of the store, and make close-to-correct assumptions on how to update the store without looking at any code. @@ -78,7 +78,7 @@ Superglue encourages you to shape UI state on the server because Conventional Rails wisdom discourages excessive view logic, but `.props` templates don't have the usual structural markup that you'd find with ERB templates. Its not uncommon to see more logic in your views. !!! note -You can think of `.props` as a presentational layer for your React components. We keep most of the UI state on the server the simplify the amount of Javascript we need. +You can think of `.props` as a presentational layer for your React components. We keep most of the UI state on the server the simplify the amount of JavaScript we need. ```ruby daily_events = @events diff --git a/docs/tutorial.md b/docs/tutorial.md index 3c70b5b5..e26e67f6 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -490,14 +490,14 @@ Update `app/controllers/items_controller.rb` to handle toggle submissions What we've built so far is a multi-page application backed by classic Rails conventions with a touch of React. Lets progressively add SPA navigation to -forms and links by bringing back a Rails favorite: [Unobtrusive Javascript](ujs.md) +forms and links by bringing back a Rails favorite: [Unobtrusive JavaScript](ujs.md) === "`show.jsx`" Update `app/views/shopping_lists/show.jsx` !!! Note Setting a HTTP method like `put` on a `` tag is not supported with - Unobtrusive Javascript. This is by design. Instead, create a form that + Unobtrusive JavaScript. This is by design. Instead, create a form that looks like a link. This is inspired by [link_to](https://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to). @@ -742,7 +742,7 @@ GET /shopping_list?props_at=data.totalCost ## Digging with `props_at` The second step behind the scenes is called [digging](./digging.md). You can -use the same `props_at` pattern with [Unobtrusive Javascript](./ujs.md) via +use the same `props_at` pattern with [Unobtrusive JavaScript](./ujs.md) via `data-sg-remote` or with [requests](./requests.md). Here's how reloading a part of the screen would look like: @@ -856,7 +856,7 @@ controller, go ahead and reload the page. Everything should still work. if @item.save - redirect_to root_path, notice: 'Item added successfully!' + respond_to do |format| - + flash[:notice] = "Item added succesfully" + + flash[:notice] = "Item added successfully" + format.html { redirect_to root_path } + format.json { render layout: "stream" } + end @@ -1020,7 +1020,7 @@ And broadcast it from the controller. + ) respond_to do |format| - flash[:notice] = "Item added succesfully" + flash[:notice] = "Item added successfully" format.html { redirect_to root_path } format.json { render layout: "stream" } end diff --git a/docs/ujs.md b/docs/ujs.md index 47474b92..8d12941c 100644 --- a/docs/ujs.md +++ b/docs/ujs.md @@ -1,6 +1,6 @@ # The return of Rails UJS -Unobtrusive Javascript is an easy way to added single page app like features to +Unobtrusive JavaScript is an easy way to added single page app like features to HTML links and form tags. Its taken a backseat since the introduction of Hotwire, but Superglue puts UJS back in the forefront and packs it with functionality that makes building SPA-like functionality easy and consistent.