Skip to content

Commit 0fa2c1c

Browse files
committed
Bump grinder and refresh code excerpts
Signed-off-by: Gavin Zhao <[email protected]>
1 parent 504e823 commit 0fa2c1c

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

pubspec.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ packages:
217217
name: grinder
218218
url: "https://pub.dartlang.org"
219219
source: hosted
220-
version: "0.9.0"
220+
version: "0.9.1"
221221
html:
222222
dependency: transitive
223223
description:

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dev_dependencies:
1717
path: site-shared/packages/code_excerpt_updater
1818
code_excerpter:
1919
path: site-shared/packages/code_excerpter
20-
grinder: ^0.9.0
20+
grinder: ^0.9.1
2121
linkcheck: ^2.0.0+1
2222
shelf_static: ^1.0.0
2323
shelf: ^1.1.4

src/guide/lifecycle-hooks.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ This example monitors the `AfterChanges` hook.
398398
<?code-excerpt "lib/src/after_changes_component.dart (ngAfterChanges)" region="ng-after-changes" title?>
399399
```
400400
ngAfterChanges() {
401-
changeLog.add('Input property has changed.');
401+
changeLog.add('Input property has changed. ($power)');
402402
}
403403
```
404404

@@ -407,9 +407,9 @@ The example component, `AfterChangesComponent`, has two input properties: `hero`
407407
<?code-excerpt "lib/src/after_changes_component.dart" region="inputs"?>
408408
```
409409
@Input()
410-
late Hero hero;
410+
Hero? hero;
411411
@Input()
412-
late String power;
412+
String power = '';
413413
```
414414

415415
The host `AfterChangesParentComponent` binds to them like this:
@@ -445,11 +445,12 @@ The *DoCheck* sample extends the *AfterChanges* sample with the following `ngDoC
445445
<?code-excerpt "lib/src/do_check_component.dart (ngDoCheck)" region="ng-do-check" title?>
446446
```
447447
ngDoCheck() {
448-
if (hero.name != oldHeroName) {
448+
final heroName = hero?.name ?? '';
449+
if (heroName != oldHeroName) {
449450
changeDetected = true;
450451
changeLog.add(
451-
'DoCheck: Hero name changed to "${hero.name}" from "$oldHeroName"');
452-
oldHeroName = hero.name;
452+
'DoCheck: Hero name changed to "${heroName}" from "$oldHeroName"');
453+
oldHeroName = heroName;
453454
}
454455
455456
if (power != oldPower) {

0 commit comments

Comments
 (0)