thecodezone.
The Code Zone
← Back to the Developer Playbook

Code Zone Bug Lab / Episode 12

The Profile That Shows Yesterday’s Name

The updated object says Codie. Rob’s profile card still says Rob.

DEV-155 · Objects · copies · current state15–20 minutesNo setup or account required
The saved Codie profile and displayed Rob profile disagree.
The saved Codie profile and displayed Rob profile disagree.

Your sprint ticket · In progress · DEV-155

The Profile That Shows Yesterday’s Name.

Customer report: I saved a new display name. The Console shows the new object, but the profile card shows the old name.

Steps to reproduce

  1. Keep Codie as the new name.
  2. Click Save demo profile.
  3. Compare the logged updated object with the profile card.

Make a focused behavior fix. Styling and adding unrelated features belong to another ticket.

Acceptance criteria

  • Saving Codie updates the profile card to Codie.
  • Saving a second name uses that latest name.
  • Updating the name preserves the role property.
  • Reset restores Rob and the original role.

Learning demo only. No real accounts, purchases, authentication, or external requests.

Reproduce → inspect → hypothesize → verify

Take the ticket.

Reproduce the bug before editing. Inspect the Console and the JS tab. Explain one hypothesis, change the relevant code, then use Check challenge below the editor. Test the full ticket, not only the starter example. Reveal hints one at a time if needed.

Checking account and saved lab work…

Sign in to sync across devices

Loading the JavaScript and HTML editor…

Pass the checks or make three attempts to unlock an explained example.

Ready to test? Choose “Check challenge” after investigating.

    Open starter in a separate tab

    Code and prediction notes recover in this browser and sync when signed in. Instructor examples stay separate. Reset replaces code, not prediction notes.

    One possible solution

    Compare this approach with your own. Opening it does not change your code or mark the exercise complete.

    The updated object is created correctly, but the UI still reads the old profile. Assign profile = updatedProfile; before renderProfile(profile). The spread preserves the existing role property. Test multiple updates and Reset.

    Try first. Reveal one clue at a time.

    Need a lead?

    1. Follow the objects.

    Which object does the Console log, and which object is passed to renderProfile?

    2. A copy is a separate value.

    Spreading profile into a new object does not automatically replace the original profile reference.

    3. Update the current reference.

    Assign profile = updatedProfile before rendering profile.

    Your lab report

    Show your reasoning.

    “I expected… I observed… The console showed… My hypothesis was… I changed… I verified…”

    Use Check challenge for automated behavior checks. Passing checks are useful evidence, not a complete code review.

    Give others room to investigate: label solutions as spoilers.

    Share your lab report on SKOOL (new tab) ↗