mirror of
https://github.com/flarum/core.git
synced 2025-07-24 02:01:19 +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:
@@ -52,6 +52,10 @@ export default class ReplyPlaceholder extends Component {
|
|||||||
// body with a preview.
|
// body with a preview.
|
||||||
let preview;
|
let preview;
|
||||||
const updateInterval = setInterval(() => {
|
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();
|
const content = app.composer.component.content();
|
||||||
|
|
||||||
if (preview === content) return;
|
if (preview === content) return;
|
||||||
|
Reference in New Issue
Block a user