Incomplete model when a topic has just been created


From the didTransition hook of a topic.* route, I access the parent’s model with this.modelFor('topic').

This works very well, except in one case: when the topic has just been created (with the API), the model I get from modelFor is incomplete. For example, it has the id property, but not the tags property. The complete model becomes available a moment later.

Which hook should I use to get the complete model?

[API] Database timeout error when deleting topics in bulk

I get the same problem when creating a topic by hand.

Here is what I do:

  1. I create a topic manually in Discourse (using the composer).
  2. I intercept the resulting route change from the didTransition hook (or from willTransition + I wait for the active transition promise to resolve).
  3. I use this.modelFor('topic') -> the tags field is not there (unless I wait more than 1 second), whereas the id field is.

I obviously use an inappropriate hook. Any hint?


I ended retrying every 500 ms until I get the tags field.