DEV: attempt to fix some system spec flakes (#30182)
Since 3e7f0867ea
, I started seeing some specs fail due to the following error
```plain
Error occurred while rendering: top-level application > discourse-root > topic > discourse-topic > topic-navigation > plugin-outlet > plugin-connector > topic-presence-display
/assets/plugins/discourse-presence.js - Uncaught TypeError: Cannot destructure property 'whisperer' of 'this.currentUser' as it is null.
```
For some reasons I can't fanthom, the presence components seem to be rendered even though they're using outlets that are only rendered when a user is signed in... 🤷♂️
Lost too much time trying to reproduce so I ended up adding this `if (!this.currentUser) { return; }` condition to both "presence display" component to (hopefully) fix these flakes.
This commit is contained in:
parent
ca0ea3d201
commit
35656a1d5f
|
@ -33,6 +33,12 @@ export default class ComposerPresenceDisplay extends Component {
|
||||||
});
|
});
|
||||||
|
|
||||||
setupWhisperChannel = helperFn((_, on) => {
|
setupWhisperChannel = helperFn((_, on) => {
|
||||||
|
// NOTE: this is here to prevent some flakes in tests
|
||||||
|
// For some random reasons, this component is being rendered even though `currentUser` is `null`
|
||||||
|
if (!this.currentUser) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { topic } = this.args.model;
|
const { topic } = this.args.model;
|
||||||
const { whisperer } = this.currentUser;
|
const { whisperer } = this.currentUser;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,12 @@ export default class TopicPresenceDisplay extends Component {
|
||||||
});
|
});
|
||||||
|
|
||||||
setupWhisperChannel = helperFn((_, on) => {
|
setupWhisperChannel = helperFn((_, on) => {
|
||||||
|
// NOTE: this is here to prevent some flakes in tests
|
||||||
|
// For some random reasons, this component is being rendered even though `currentUser` is `null`
|
||||||
|
if (!this.currentUser) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { topic } = this.args;
|
const { topic } = this.args;
|
||||||
const { whisperer } = this.currentUser;
|
const { whisperer } = this.currentUser;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue