angular-threejs/angular-three

NOTICE: recent breaking changes with timing for some Custom Inject Functions

Closed this issue · 0 comments

Hi folks, I'm posting this as an issue to get folks' attention.

Technically, since we're still in beta, there's really no breaking change but I feel responsible for letting people know this change.

Context

There are various Custom Inject Functions (functions that start with inject*** and make use of APIs that rely on Injection Context) in Angular Three (i.e: injectLoader, injectAnimations, injectFBO etc...).

These functions use afterNextRender INTERNALLY to assert certain things from a timing perspective (eg: after first render has finished) to proceed with their own logic.

Change

Latest release (2.0.0-beta.314) removes ALL internal afterNextRender. The timing control should be the consumers' responsibility rather than the library. Please check the following commits and their messages for more details

d57d1cc
537be01
0599c1a
47dba57
c325c92

TLDR; control the timing by using Signal<FnParameterType | SomeFalsyType> (SomeFalsyType can be undefined, null, or undefined | null, or literally anything that would pass the JavaScript falsy check) or use other timing fn like afterNextRender (and its phases).

Exceptions

angular-three-cannon is the current exception to this change. injectBody and injectConstraint still use afterNextRender internally. This is probably a soft blocker for v2 unfortunately.

Please let me know if you have any question at all