The observer is null if user prefers reduced motion

Turns out TypeScript is there for a reason and shouldn't be bypassed. Fixes #1135
This commit is contained in:
Jake Archibald
2021-08-25 14:10:57 +01:00
parent 0d35fbd349
commit 6e427f9208

View File

@@ -42,7 +42,7 @@ export default class SlideOnScroll extends Component<Props, State> {
// Have to manually disconnect due to memory leaks in browsers.
// One day we'll be able to remove this, and the private property.
// https://twitter.com/jaffathecake/status/1405437361643790337
this.observer!.disconnect();
if (this.observer) this.observer.disconnect();
}
render({ children }: RenderableProps<Props>) {