mirror of
https://github.com/discourse/discourse.git
synced 2025-04-25 22:54:32 +08:00
FIX: Make CookText component reactive (#23709)
When navigating between renewables through the Ember router, e.g. through the links in the notifications menu the body of the reviewable (rendered by the CookText component) won't update, resulting in the same post body incorrectly being shown for all subsequent reviewables. This is happening because there is no update path between the rawText attribute being passed to CookText and the computed cooked attribute, since this is being set explicitly using an async function. This PR adds the missing link between rawText and cooked by listening for didUpdate and triggering the async function.
This commit is contained in:
parent
3f6adca2d7
commit
408579e6b2
@ -16,6 +16,7 @@ export default class CookText extends Component {
|
||||
{{didUpdate this.buildOneboxes this.cooked}}
|
||||
{{didUpdate this.resolveShortUrls this.cooked}}
|
||||
{{didUpdate this.calculateOffsetHeight this.cooked}}
|
||||
{{didUpdate this.loadCookedText @rawText}}
|
||||
>
|
||||
{{this.cooked}}
|
||||
</div>
|
||||
@ -29,6 +30,7 @@ export default class CookText extends Component {
|
||||
this.loadCookedText();
|
||||
}
|
||||
|
||||
@action
|
||||
async loadCookedText() {
|
||||
const cooked = await cookAsync(this.args.rawText);
|
||||
this.cooked = cooked;
|
||||
|
Loading…
x
Reference in New Issue
Block a user