transloco icon indicating copy to clipboard operation
transloco copied to clipboard

fix(transloco): 🐛 Avoid toObservable on signal API + string key

Open maleetz opened this issue 1 month ago • 1 comments

Simplifies the common use case of static keys / params for the signal APIs by avoiding the toObservable call, which uses the angular effect API to listen to changes from the signal and propogate those into the observable stream. Using the effect call causes the component to render twice, once with an empty string as the signal value and the second time asyncronously with the actual value.

✅ Closes: #894

PR Checklist

Please check if your PR fulfills the following requirements:

  • [x] The commit message follows our guidelines: https://github.com/jsverse/transloco/blob/master/CONTRIBUTING.md#commit
  • [x] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • [x] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, local variables)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] CI related changes
  • [ ] Documentation content changes
  • [ ] Other... Please describe:

What is the current behavior?

Issue Number: #894

What is the new behavior?

This change simply removes the toObservable call for static use cases and replaces it with a basic of call, thereby removing the async nature of toObservable.

Does this PR introduce a breaking change?

  • [ ] Yes
  • [x] No

Other information

maleetz avatar Dec 02 '25 15:12 maleetz

Open in StackBlitz

@jsverse/transloco

npm i https://pkg.pr.new/jsverse/transloco/@jsverse/transloco@895
@jsverse/transloco-locale

npm i https://pkg.pr.new/jsverse/transloco/@jsverse/transloco-locale@895
@jsverse/transloco-messageformat

npm i https://pkg.pr.new/jsverse/transloco/@jsverse/transloco-messageformat@895
@jsverse/transloco-optimize

npm i https://pkg.pr.new/jsverse/transloco/@jsverse/transloco-optimize@895
@jsverse/transloco-persist-lang

npm i https://pkg.pr.new/jsverse/transloco/@jsverse/transloco-persist-lang@895
@jsverse/transloco-persist-translations

npm i https://pkg.pr.new/jsverse/transloco/@jsverse/transloco-persist-translations@895
@jsverse/transloco-preload-langs

npm i https://pkg.pr.new/jsverse/transloco/@jsverse/transloco-preload-langs@895
@jsverse/transloco-schematics

npm i https://pkg.pr.new/jsverse/transloco/@jsverse/transloco-schematics@895
@jsverse/transloco-scoped-libs

npm i https://pkg.pr.new/jsverse/transloco/@jsverse/transloco-scoped-libs@895
@jsverse/transloco-utils

npm i https://pkg.pr.new/jsverse/transloco/@jsverse/transloco-utils@895
@jsverse/transloco-validator

npm i https://pkg.pr.new/jsverse/transloco/@jsverse/transloco-validator@895

commit: 15ed0d5

pkg-pr-new[bot] avatar Dec 02 '25 15:12 pkg-pr-new[bot]