JavaScript · Intermediate · Ticket 6Ticket #24 · from Hannah Cole, Senior Engineer
  1. Example
  2. Warm-up 1
  3. Warm-up 2
  4. Ticket
Brief
NEW TICKET#24 · Account settings

Merge settings without changing the defaults

Hannah Cole · Senior Engineer
Opened today

“Something odd in last night's monthly emails: everyone after Ana got their totals in euros, because Ana picked EUR. settingsForAll gives each user our defaults with their own choices on top, and it's changing the defaults themselves, so one user's choice leaks into the next. Also, people who change only their reminder days ("remind me 7 days before") lose the email setting that goes with it. Every user should get every default they haven't changed, including inside reminders. Can you fix it?”

YOUR PLAN
  1. 1Watch an example2 min
  2. 2Warm-up 11 min
  3. 3Warm-up 21 min
  4. 4Fix the ticket16 min
BY THE END YOU CAN
  • Spot when code changes an object it should only read
  • Copy objects with spread instead of Object.assign onto the original
  • Merge one level deeper where it's needed
About 20 minutes
Four short steps. Nothing is timed, and you can leave any time.