Skip to content

Stop project controller errors on the unshipped ship form - #8

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixship-stop-project-controller-5807e3
Draft

posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixship-stop-project-controller-5807e3

Conversation

@posthog

@posthog posthog Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Problem

  • Every builder who opens the ship form before they ship gets two JavaScript errors. This adds noise to error tracking on the last step of the project journey.
  • ships/show.html.erb puts data-controller="project" on the page root. Only the "Shipped." branch renders the Clippy sprite target. The form branch does not.
  • connect() reads this.spriteTarget with no guard, so Stimulus throws "Missing target element". this.clippy stays unset, so disconnect() then throws on this.clippy.stop().

Origin

  • Error tracking: issue 1, issue 2
  • First signal: 2026-10-07
  • Inbox report: open
  • Likely cause: 304ba47
  • Task started by: auto-start, after the report was rated P3 and ready to fix

Changes

  • The project controller now does nothing when the page has no sprite. connect() returns early if hasSpriteTarget is false, and disconnect() calls this.clippy?.stop().
  • #hop needs no guard of its own: it runs only after Clippy exists, and the clippy and sprite targets always render together.
  • No change to the project page or the "Shipped." screen. Both render the sprite, so Clippy behaves as before.

Testing

Check Result
node --check on the controller Pass
Node check with stubbed Stimulus and Clippy: form branch (no sprite) connect() and disconnect() do not throw
Same check: "Shipped." branch (sprite present) Clippy is created, hops, and stops
bin/rails test:system (project_test.rb shipping test) Not run. The sandbox has no Ruby and no Chrome. CI runs it.
bin/rubocop, brakeman, importmap audit Not run (no Ruby). This PR changes no Ruby files.

Agent context

  • I did not choose to move data-controller="project" onto the "Shipped." block only. That change also moves the clippy, mood and sounds values. A guard in the controller is smaller and also protects any future page that has no sprite.
  • Success: both error tracking issues ("Missing target element" on /project/ship and the stop on undefined error) get no new occurrences after deploy.

Created with PostHog Desktop from this inbox report.

🤖 Generated with Claude Code

The ship form attaches the project controller but renders no Clippy sprite. connect() now returns early when the sprite target is missing, and disconnect() stops Clippy only if it exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: 33586a60-4e5a-4222-a751-3f4e26fbe901

This branch has not been deployed

No deployments
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.

0 participants