mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 20:31:13 +00:00
Fixing unload
This commit is contained in:
parent
387f474b09
commit
5af9346ce0
1 changed files with 5 additions and 5 deletions
|
@ -88,6 +88,7 @@ interface PostState {
|
||||||
export class Post extends Component<any, PostState> {
|
export class Post extends Component<any, PostState> {
|
||||||
private subscription: Subscription;
|
private subscription: Subscription;
|
||||||
private isoData = setIsoData(this.context);
|
private isoData = setIsoData(this.context);
|
||||||
|
private commentScrollDebounced: () => void;
|
||||||
private emptyState: PostState = {
|
private emptyState: PostState = {
|
||||||
postRes: null,
|
postRes: null,
|
||||||
postId: getIdFromProps(this.props),
|
postId: getIdFromProps(this.props),
|
||||||
|
@ -178,7 +179,8 @@ export class Post extends Component<any, PostState> {
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.subscription.unsubscribe();
|
this.subscription.unsubscribe();
|
||||||
document.removeEventListener("scroll", this.trackCommentsBoxScrolling);
|
document.removeEventListener("scroll", this.commentScrollDebounced);
|
||||||
|
|
||||||
window.isoData.path = undefined;
|
window.isoData.path = undefined;
|
||||||
saveScrollPosition(this.context);
|
saveScrollPosition(this.context);
|
||||||
}
|
}
|
||||||
|
@ -189,10 +191,8 @@ export class Post extends Component<any, PostState> {
|
||||||
);
|
);
|
||||||
autosize(document.querySelectorAll("textarea"));
|
autosize(document.querySelectorAll("textarea"));
|
||||||
|
|
||||||
document.addEventListener(
|
this.commentScrollDebounced = debounce(this.trackCommentsBoxScrolling, 100);
|
||||||
"scroll",
|
document.addEventListener("scroll", this.commentScrollDebounced);
|
||||||
debounce(this.trackCommentsBoxScrolling, 100)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(_lastProps: any, lastState: PostState) {
|
componentDidUpdate(_lastProps: any, lastState: PostState) {
|
||||||
|
|
Loading…
Reference in a new issue