~/talk

Refactoring Components

Talkat DDD Perth 2022 · on Saturday, 2022-09-10· [component-design, frontend-architecture]
slides:none on file

Refactors a date-formatting helper from moment to date-fns using characterization tests to lock current behavior (including a discovered bug where 0 returns an empty string) and a try/catch to preserve it; runs ~7–8 tests that protect a function used in over 300 places. Evaluates snapshot tests (when they help and where they lie), extracts a NumberInput component from a large product page, and adds a new “plants” product — tests pass and the change lands cleanly.

AI-written summary · about

  1. 0:00Introduction
  2. 1:02Speaker introduction
  3. 2:08Talk overview
  4. 2:50What is refactoring
  5. 4:15When to refactor
  6. 5:17Refactoring costs and risks
  7. 6:42Refactoring safely
  8. 8:05Refactoring moment.js to date-fns
  9. 9:29Characterization tests
  10. 19:59Testing JSX with snapshots
  11. 26:50Snapshot test limitations
  12. 27:55Live refactoring demo
  13. 41:28Adding new features after refactor
  14. 43:55Key takeaways
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.