Skip to content

fix(code): Stagger initial typing animation#549

Open
ALikesToCode wants to merge 1 commit intoTHU-MAIC:mainfrom
ALikesToCode:fix/code-element-staggered-typing
Open

fix(code): Stagger initial typing animation#549
ALikesToCode wants to merge 1 commit intoTHU-MAIC:mainfrom
ALikesToCode:fix/code-element-staggered-typing

Conversation

@ALikesToCode
Copy link
Copy Markdown

@ALikesToCode ALikesToCode commented May 10, 2026

Summary

Fix the code element entrance animation so multi-line code starts with animation state available on the first render instead of applying it asynchronously after rows have already mounted. This preserves the intended line-by-line typewriter reveal.

Related Issues

Fixes #531

Changes

  • Move code-line animation state and delay calculation into focused, testable helpers.
  • Initialize first-render typing animation state synchronously before CodeLineRow mounts.
  • Remove the setTimeout(..., 0) animation-state handoff that let all rows enter the typing path together.
  • Add regression tests for first-render typing state, disabled animation, inserted/replaced lines, and cumulative typing delays.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or build changes

Verification

Steps to reproduce / test

  1. Render a code element with animation enabled and multiple lines.
  2. Confirm each line has typing animation state before CodeLineRow mounts.
  3. Confirm typing delays are cumulative so lines reveal sequentially instead of all starting together.

Local checks

  • pnpm exec vitest run tests/code-element/line-animation.test.ts - passed, 1 test file and 4 tests.
  • pnpm check - passed.
  • pnpm lint - passed with existing warnings outside this PR.
  • pnpm exec tsc --noEmit - passed.
  • pnpm check:i18n-keys - passed.
  • pnpm test - passed, 43 test files and 317 tests.
  • git diff --check - passed.

Build and runtime checks

  • pnpm build - passed.
  • pnpm dev - started successfully on http://localhost:3001 after port 3000 was already in use.
  • curl -I http://localhost:3001 - returned HTTP 200.
  • curl http://localhost:3001/api/health - returned success: true, status: ok, version 0.2.1.
  • Playwright browser smoke test for / - HTTP 200, title OpenMAIC, 0 captured page/console errors.
  • Playwright browser smoke test for /eval/whiteboard - HTTP 200, title OpenMAIC, 0 captured page/console errors.

Regression coverage

  • First-render code lines receive typing animation state before row mount.
  • Disabled animation produces no animation state.
  • Inserted and replaced lines are detected after the first render.
  • Typing delays accumulate per line so multi-line code reveals sequentially.

CI evidence

Checklist

  • My code follows the project's coding style.
  • I have performed a self-review of the code.
  • No documentation update is required for this bugfix.
  • The changes do not introduce new lint or test failures.

@ALikesToCode ALikesToCode changed the title fix(code): stagger initial typing animation Stagger initial typing animation May 10, 2026
@ALikesToCode ALikesToCode changed the title Stagger initial typing animation fix(code): Stagger initial typing animation May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Code element entrance animation starts typing on all lines at once instead of line-by-line

1 participant