1
0
mirror of https://github.com/flarum/core.git synced 2025-07-23 09:41:26 +02:00

Fix race condition in post preview

The post composer could have been closed in between scheduling and
executing the callback.

Fixes flarum/org#58.
Refs #1881.
This commit is contained in:
Franz Liedke
2020-02-07 12:17:11 +01:00
parent 1941d86c15
commit 5179221a08

View File

@@ -52,6 +52,10 @@ export default class ReplyPlaceholder extends Component {
// body with a preview.
let preview;
const updateInterval = setInterval(() => {
// Since we're polling, the composer may have been closed in the meantime,
// so we bail in that case.
if (!app.composer.component) return;
const content = app.composer.component.content();
if (preview === content) return;