Skip to content

Fix postcode-change listener being removed after Turbo navigation - #2

Merged
Jade-GG merged 1 commit into
masterfrom
feature/FW-2726/fix-autoremove-option
Oct 9, 2026
Merged

Jade-GG merged 1 commit into
masterfrom
feature/FW-2726/fix-autoremove-option

Conversation

@claudio-ferraro

Copy link
Copy Markdown
Member

The postcode-change listener was registered with { autoremove: false }, but the on() helper in rapidez/core only reads autoRemove (camelCase). The option was ignored, so the listener kept the default autoRemove: true.

Since core 5.6.0 (rapidez/core#1360) autoRemove listeners are cleaned up on turbo:before-cache. package.js only runs once, on the first page load, so after the first Turbo navigation nothing listens to postcode-change anymore. Street and city are then only filled in after a hard refresh of the checkout. This now uses autoRemove, so the listener stays registered.

The typo came along from the deprecated postcode packages, which have the same issue. It most likely originates from the docblock in core's emit.js, which also says autoremove.

  • Impact: the postcode lookup works again after Turbo navigation, e.g. when going from the cart to the checkout.
  • Breaking: no.
  • Branch: master only.
  • Docs: nothing to update.
  • Tests: there are no JS tests in this package. I reproduced it in a Rapidez 5.9 project with headless Chrome: after a Turbo visit, emitting postcode-change no longer triggered a request to /api/postcode, while a test listener registered with autoRemove: false still fired. After this fix the lookup keeps working after Turbo navigation.
  • Reference: FW-2726

@Jade-GG
Jade-GG merged commit a852628 into master Oct 9, 2026
18 checks passed
@Jade-GG
Jade-GG deleted the feature/FW-2726/fix-autoremove-option branch October 9, 2026 08:48
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.

2 participants