By Developers, For Developers

Historical errata for Modern Front-End Development for Rails

PDF PgPaper PgTypeDescriptionFixed onComments
34TYPO

Paragraph after application.ts code block, second sentence:

> If I attempt to invoke a property of the class this not either defined in this list or as method in the class body, such as this.banana, …

I think the first should be “that’s either not” and the second is just “a method”.

2019-12-02
35TYPO

Paragraph after the first “application.ts” code block, first sentence:

> …when a new instance of the class is crated.

Should be “created”.

2019-12-02
38TYPO

Second paragraph, third sentence:

> We’re creating a module this file in that can be loaded in to other code using import.

This should probably read: “We’re creating a module in this file that can be loaded into other code using import.”

2019-12-02
14ERROR

The HTML codes in “schedules/show.html.erb” code block have an error:

<% @schedule.schedule_days.each do |schedule_day| %> <section class=“day-body”
…

The section class “js—day” should move in to the second section beside the “day-body”.

2019-12-03Correct, fixed
14TYPO

The “heading introduction/02/app/views/schedules/show.html.erb”

should read “introduction/02/app/layouts/views/schedules/show.html.erb”

2019-12-03Thanks for your submission, I think this is correct as written.
266ERROR

When installing styled components with any of the following commands, I receive an error.

Commands used:
yarn install —check-files
yarn add styled-components
yarn add @types/styled-components

Error:
yarn add v1.17.0
error An unexpected error occurred: “/Users/Name/Desktop/programs/learning/code/css/03/package.json: Unexpected token
in JSON at position 518”.

2019-12-03See next item for comment.
266ERROR

Edit to my previous technical error (in the code). The solution is simply that line 18 “stimulus”: “url_… Erratum will not allow me to post the link”, should be on one line. Currently, from the code, it is on two lines.

When installing styled components with any of the following commands, I receive an error.

Commands used:
yarn install —check-files
yarn add styled-components
yarn add @types/styled-components

Error:
yarn add v1.17.0
error An unexpected error occurred: “/Users/Name/Desktop/programs/learning/code/css/03/package.json: Unexpected token
in JSON at position 518”.

2019-12-03In the PDF it's all one line, I'll clarify in the text! Thanks!
21TYPO

First paragraph after the generic_toggle.ts code block. Last sentence of the paragraph has some typos and is really awkward and hard to parse:

> “The querySelectorAll method has a return type of NodeListOf, and so two of our three instance properties, toggleButtons and targets, a results of calling querySelectorAll, and both of those properties are type NodeListOf.”

In context it might be better to shorten it to something like:

“And since toggleButtons and targets are the result of calling querySelectorAll, both of those properties are of type NodeListOf.”

Also, I think the type should be changed from NodeListOf to NodeListOf so it matches the code block.

2019-12-03Thanks! The text has been clarified.
21TYPO

Last paragraph on page contains a few typos:

> Often this means the generic type a type that contains elements of another type.
- Missing the word “is”.

> For example, an Set might behave similarly whether it is an set of Strings or an set of Numbers—the set itself still responds to, say add.
- The “an”s should be “a”

2019-12-02
23TYPO

Second paragraph, second sentence:

> The “type” of onToggle looks like a function with three arguments which with the body being void.

Probably should be something like “… a function with three elements that has a body of void.”

2019-12-02
23TYPO

Fourth paragraph, second sentence:

> …and we check the status of the one of the targets to set the initial hidden state of the toggle itself.
- Extra “the”

2019-12-02
26TYPO

Second bullet, last sentence (right before the “What’s Next” heading):

> …but in React, you’ll see that it is design to automatically redraw components when their internal state changes.

Should be “designed”.

2019-12-02
8ERROR

From the initial introductory reading on how this book works, I presumed that the source first version of the source code would not have webpacker installed so you could follow along with the book step by step actions. In the included sourcecode, on 01, it turns out Webpacker is already installed.

2019-12-03Okay, I've changed the code to be clearer; this may be worth revisiting in a future pass over the chapter.
xERROR

There is no “bin/setup.rb” in the source code archive files, but the book says:
“If you download the code and run bin/setup.rb, that should install the Ruby dependencies on a Mac, Linux, or Windows/Bash setup, and also seed the database with a bunch of random startup data.”

2019-12-03Okay, I think I see the problem here, I've clarified the surrounding text to read: \n \n~~~ \nThe code uses PostgreSQL, so you'll need to have that set up on your machine. The sample code is split into a number of different directories, each corresponding to a different stage of the app in the book. Examples in the book will specify which directory is being used at any time. \n \nIf you download the code and run `bin/setup.rb` within the `introduction/01` directory (or any of the individual application directories), that should install the Ruby dependencies on a Mac, Linux, or Windows/Bash setup, and also seed the database with a bunch of random startup data. \n~~~
1124TYPO

of the dependences -> of the dependencies

2020-02-06
54TYPO

{
seatNumber}<
has an extra “<” before “/span”

2020-02-06
58ERROR

The code listen for “turbolinks:load” in “document.addEventListener(”turbolinks:load“,…” but the text in the following sections explains that we listen for event “DOMContentLoaded”

2020-02-07
63TYPO

In “This pattern is called called “lifting state” there are 2 “called”

2020-02-06
4TYPO

There is a double “the” in the sentence, “A lot of the decisions about program structure in web applications are about how to manage state, by which I mean the data that controls the the interactions between the user and the application”

2020-02-06
5TYPO

Missing the word “to” in the sentence, “We also want make the program as easy as possible to understand and change.”

2020-02-06
??TYPO

In the “React” chapter “Adding Our First Component” section, it says, “By declaring this interface, we allow TypeScript to do compile-type type checking to ensure that the necessary values are passed to our components.”

I believe it should probably say “compile-time type checking”.

2020-02-06
??TYPO

In the “React” chapter “Composing Components” section, it says, “Invoking a component from another component normally involves a JSX call that looks as thought the component was an HTML tag, with the name of the component first and the props following with the same syntax as used to write HTML attributes.”

I believe it should probably say, “looks as though”

2020-02-06
14SUGGEST

Says “Specifically, I’ve added the ESLint code cleanup tool and the Prettier code formatter. These help keep my code clean as I write it, but I’ll talk about the details of how I have them configured in Chapter 5, TypeScript, on page 93.”

But, there doesn’t appear to be a description of how these are configured in this area. Elsewhere there’s a small description of ESLint, but nowhere in the book does it describe how prettier is configured.

2020-02-07Temporarily fixed by removing the reference, I'll put it back when that part of the book comes back into the outline
30SUGGEST

Says “We’re leaving the index.js file itself in JavaScript rather than convert- ing it to TypeScript for the moment because changing it requires a TypeScript feature we haven’t discussed yet—we’ll come back to it later in the book.”

But, the book doesn’t seem to discuss converting it to TypeScript or suggest what TypeScript feature might be required.

2020-02-07It should come in the book in the advanced typescript chapter, which isn't in the betas yet.
47TYPO

Paragraph 2 reads: ‘Four our purposes in this book…’

2020-02-06
62TYPO

There are two “the”s in the sentence, " We then change the value of status based on the the current value of status using the setState function, also the one defined by useState, to officially register the change with React."

2020-02-06
??ERROR

We start with Array.from(Array(props.seatsInRow)) , which is an obscure JavaScript idiom to turn the number 5 into the array [1, 2, 3, 4, 5]

Noel Rappin. Modern Front-End Development for Rails (Kindle Locations 1947-1949).

I am using node 10.15.3 and the array I get from this is [0,1,2,3,4]

2020-03-21
12TYPO

it says: ‘…if you run bin/setup.rb’, but the files provided had no extension, so the command is just ‘bin/setup’. Otherwise you get the error ‘bash: bin/setup.rb: No such file or directory’

2020-03-21
38TYPO

“We can do all of these things using another Stimulus concepts, values.” Concept should be singular

2020-03-20
39TYPO

“In our case, an “visible” value, where visible is true, means that the target is
not hidden." Visible’s preposition should be “a,” not “an” because visible starts with a consonant.

2020-03-20
94TYPO

“I’m going to talk about one one of these libraries that has an interesting way to insert CSS into your React code: styled-components.” The word “one” is duplicated.

2020-03-20
105TYPO

“In TypeScript, though, this very legal.” This sentence is missing a verb.

2020-03-20
114TYPO

“In a non-production environment, if you try to start a Rails server, run a Rake task or do anything else that starts the Rails environment, Rails will check that the yarn.lock file and the node_modules directory are consistent, and if not, i will stop and ask you to re-run yarn install before proceeding.” should be “it will stop,” not “i will stop.”

2020-03-20
133TYPO

“On the Stimulus page in our sample app, we’re going get information from the server about which concerts are sold out.” This sentence is missing the word “to;” it should read, “we’re going TO get information from the server.”

2020-03-20
134TYPO

“On the other hand, the Gon gem very easy to use and explain.” The author probably intended, “the Gon gem IS very easy to use and explain.”

2020-03-20
142TYPO

“This will use the fetch method we’ve already seen, as well as a React hook called useState that we haven’t seen.” “that we haven’t seen” should be removed. A lot of information about useState is provided in the “Interactivity, State, and Hooks” section of the React chapter in the first section of the book.

2020-03-20
154TYPO

“% rails generate channel ScheduleChannel
This will generate two files: a server side file app/channels/test_channel.rb and a client side file app/javascripts/channels/test_channel.js.” rails generate channel ScheduleChannel generates schedule_channel.rb and schedule_channel.js. At one point, the author probably was generating “TestChannel,” but these file names should be changed. They also appear correctly later on in the chapter.

2020-03-21Thanks for catching this!
157TYPO

“Please note that this example is slightly faked in the sense that in new concerts are not being added to the
sold-out list, and we are deliberately keeping the sold out state from begin set correctly on the initial server-side render of the page so that we can see the page change from ActionCable.” The word “begin” is probably actually supposed to be “being.”

2020-03-20
158TYPO

“There’s more detail in the official ActiveCable documentation” It should say “ActionCable,” not “ActiveCable.”

2020-03-20
165TYPO

“Then we’ll talk about Redux, a library that implements the reducer pattern and is commonly used with Redux.” It should say that Redux “is commonly used with REACT,” not with itself.

2020-03-20
168ERROR

I think the page numbers skipped a number. The last page of chapter 8 is 164. The title page for Part III should be 165 and the first page of chapter 9 should be 166 making the second page 167. But the second page of chapter 9 is 168.

2020-03-20Hi! Don't worry, a page isn't missing. The pagination accounts for the blank page that would appear following the part page in the print version of the book. -Editor
189ERROR

I think the code for venue.tsx is incorrect for the section. It doesn’t match the discussion that follows for that particular file.

2020-03-21Yep, the code insert was mislabeled in my text. Thanks for catching this!
185TYPO

In this section, I’m going to recreate all the previously exiting page logic plus the subtotal calculator, except for the part that uses ActionCable." Should be “existing,” not “exiting.”

2020-03-20
3724TYPO

Hello, I think on this page the class used for the query selector may be wrong. I think the intention is to use the js- class name.

Now it is:
document.querySelectorAll(“.day-body”)

I think the intent is
document.querySelectorAll(“.js—day”)

2020-03-21Thanks for commenting! I believe this is correct as written -- the day-body selector is the individual day, js-day is all the days.
20SUGGEST

I was having trouble reading through this class, but after changing the variable names a bit it became a lot easier to read.
Maybe a matter of personal taste, but these class names helped me out:

export default class GenericVisibilityToggle {
toggleVisibilityButtons: NodeListOf
targetForVisiblity: NodeListOf
hidden: boolean

constructor(
private parent: Element | Document,
private toggleVisiblityButtonSelector: string,
private targetForVisiblitySelector: string,
private onToggleCallback?: (
toggleVisibilityButton: HTMLElement,
targetForVisibility: HTMLElement,
state: boolean
) => void
) {

2020-03-21I'll look at this issue when I do a final pass through all the code -- thanks for the suggestion
3724TYPO

In chapter 2 there is mentions to the element with class .js—schedule-day but it still does not exist anywhere in the UI. The book mentions to check the file app/views/schedules/show.html.erb but no element exists with that class.

2020-03-21Thanks for commenting! \n \nOn line 5 of app/views/schedules/show.html.erb, I see this \n \n
\n \nThat's the element in question.
189TYPO

Wrong code shown for venue.tsx. It’s showing code for Chapter 8 (Talking to the Server). Should be code for Chapter 10 (Managing State in React).

2020-03-21Yep, the code insert was mislabeled in my text. Thanks for catching this!
95TYPO

“then the return value is inferred to be the type from the that element’s tuple declaration.”

“the” before “that element’s…” should be omitted

2020-03-20
127ERROR

The page states, “Currently we’re using the Bulma CSS framework, which we are loading from Bulma’s CloudFlare CDN account. But we can move it in-house by adding it to our Webpacker packs.” however this isn’t true as we moved to using bulma via webpacker in chapter 4 on PDF page 72.

2020-03-21Thanks!
8168TYPO

“a parent component holding onto state for all it’s child components”

it’s > its

2020-03-20
164154TYPO

This will generate two files: a server side file app/channels/test_channel.rb and a client side file app/javascripts/channels/test_channel.js.

should say

This will generate two files: a server side file app/channels/schedule_channel.rb and a client side file app/javascripts/channels/schedule_channel.js.

2020-03-21Thanks for catching this!
165155TYPO

render(json: {soldOutConcertIds: sold_out_concert_ids})

When this code was first introduce in the book, the param was not camelCase:

render(json: {sold_out_concert_ids: sold_out_concert_ids})

2020-03-21I think I changed this in the background and didn't update older parts of the code, all the code still works, and we'll do a consistency check once all the code is in. \n \nThanks!
167157TYPO

• The web request is routed to the show method of the SoldOutConcertSource.

should say

• The web request is routed to the show method of the SoldOutConcertsController.

2020-03-21Thanks!
196188TYPO

<Then we declare two TypeScript interfaces

should be:

Then we declare two TypeScript interfaces

2020-03-23
197189TYPO

This make the reducer state and reducer dispatch available

should be

This makes the reducer state and reducer dispatch available

2020-03-23
197189ERROR

The code snippets moving forward are probably from the wrong chapter, that is, /server rather than /state.

The text says things like “It’s just calling three other components: the VenueHeader and VenueBody we already had, and our new one, Subtotal.” but the code is an older version without the Subtotal part

2020-06-04
9SUGGEST

It doesn’t actually say it anywhere there, but in order to get yarn running, you’d need to install node.js and npm install yarn.

Otherwise you get a hard-to-read error while doing the first bundle exec rails webpacker:install

Maybe this should be told to the readers?

2020-06-05I think I need to go through this with Yarn 2.0, but some additional text would be useful here.
14xiiERROR

The setup process probably requires some work.
Running ruby bin/setup for introduction / 01 stops with multiple problems.
There are simple things like the setup script running rails with a command starting with bin/rails while rails is in the same directory as the setup script.
But there are also more complex things like a whole lot of settings in database.yml and the postgresql database itself that would need to be set up before the setup can go through. None of those settings have been explained in the text. Maybe they should?

2020-06-05I think it's true that we could use some more discussion here, but the bin/setup is the default Rails one, and I didn't change it. The previous paragraph mentions that Postgres is required for the code, but we could provide a link to install, and maybe a link to a more general Rails installation guide.
44ERROR

In the package.json section you reference a library called “actionstorage”. I believe you meant *active*storage.

2020-06-04Yep, I think I've got this
162ERROR

It should be @status not status. I couldn’t update the seats without changing that

I'm not sure where this is, but I'm looking on page 162, and I'm not sure I see where `@status` instead of `status ` would fix a problem. Please supply more information?
72ERROR

On page 72, near the bottom, we are told to include <%= stylesheet_pack_tag(“application”) %> in layouts/application.html.erb. It stands to reason that we should also remove the existing line that directly imports the framework, but this is not stated explicitly in the book. I checked the different versions of the app in the css folder of the book code, and though the direct import line has been removed in the application layout file, the stylesheet_pack_tag is not present in any version of this file. Furthermore, including it or not doesn’t seem to make a difference.

2020-06-05You actually don't remove the existing line, you are supposed to have both. Or at least, you were, this has changed, and the the styleheet_pack_tag isn't in the final code. This behavior also changed somewhat in Webpacker 5.0, so this will be fixed as we go back through the book before tech review.

Categories: