ember-contextual-services icon indicating copy to clipboard operation
ember-contextual-services copied to clipboard

Fix route lifecycle issues

Open ctjhoa opened this issue 3 years ago • 3 comments

Please read commit descriptions to understand those changes. This gives complex examples but at least it's correct from a promise flow POV.

ctjhoa avatar Jan 12 '22 17:01 ctjhoa

To avoid this vivious cycle we must initialize contextual services after the transition is completed.

do we want to do that? it means we can't access query params until the transition is done.

If we instead cache based on URL / transition.intent? maybe that would be better?

NullVoxPopuli avatar Jan 12 '22 17:01 NullVoxPopuli

To avoid this vivious cycle we must initialize contextual services after the transition is completed.

do we want to do that? it means we can't access query params until the transition is done.

initialized may not be the right term. We must resolve personService dependency injection when the transition is complete.

If we instead cache based on URL / transition.intent? maybe that would be better?

The issue is mainly here: https://github.com/NullVoxPopuli/ember-contextual-services/blob/master/addon/utils.ts#L24 We cannot be based on:

  • URL as dynamic segment will not work.
  • transition.intent as router service doesn't have access to the current transition.

ctjhoa avatar Jan 24 '22 09:01 ctjhoa

Sorry it's been so long

URL as dynamic segment will not work.

Kinda depends on how we want them to work, we can make them work with a different cache key format.

transition.intent as router service doesn't have access to the current transition.

the current transition is just transition though, why would we need to access that same object from the intent?

NullVoxPopuli avatar Jan 24 '22 18:01 NullVoxPopuli