mirror of
https://github.com/wassname/talk.git
synced 2026-08-14 12:50:17 +08:00
[next] Auth Callback + Chunking (#2139)
* feat: added new auth-callback * fix: removed unused polyfill code * fix: fixed missed intersection observer * feat: enabled vendor chunks * fix: fix some issues with chunk splitting * fix: added intersection-observer to app polyfill * fix: fixed test * fix: removed lodash plugin which caused issue in prod * chore: access_token -> accessToken * feat: Show social login errors * fix: lint + add test * fix: restore width after facebook social login
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import * as React from "react";
|
||||
|
||||
import { createContextHOC } from "talk-framework/helpers";
|
||||
import ensurePolyfill from "./ensurePolyfill";
|
||||
|
||||
export type IntersectionCallback = (entry: IntersectionObserverEntry) => void;
|
||||
export type Observe = (
|
||||
@@ -24,18 +23,16 @@ export class IntersectionProvider extends React.Component<any, any> {
|
||||
private unmounted = false;
|
||||
|
||||
public componentDidMount() {
|
||||
ensurePolyfill().then(() => {
|
||||
if (this.unmounted) {
|
||||
return;
|
||||
}
|
||||
this.observer = new IntersectionObserver(this.onIntersect, {
|
||||
root: this.props.node ? this.props.node : undefined,
|
||||
rootMargin: "0px",
|
||||
threshold: 0.25,
|
||||
});
|
||||
this.elementBuffer.forEach(element => this.observer.observe(element));
|
||||
this.elementBuffer = [];
|
||||
if (this.unmounted) {
|
||||
return;
|
||||
}
|
||||
this.observer = new IntersectionObserver(this.onIntersect, {
|
||||
root: this.props.node ? this.props.node : undefined,
|
||||
rootMargin: "0px",
|
||||
threshold: 0.25,
|
||||
});
|
||||
this.elementBuffer.forEach(element => this.observer.observe(element));
|
||||
this.elementBuffer = [];
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
/**
|
||||
* Loads intersection-observer polyfill if it doesn't exist.
|
||||
*/
|
||||
export default async function ensurePolyfill() {
|
||||
if (!(window as any).IntersectionObserver) {
|
||||
await import("intersection-observer");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -4,4 +4,3 @@ export {
|
||||
withIntersectionContext,
|
||||
} from "./IntersectionContext";
|
||||
export { default as withInView } from "./withInView";
|
||||
export { default as ensurePolyfill } from "./ensurePolyfill";
|
||||
|
||||
Reference in New Issue
Block a user