Skip to content

Commit

Permalink
Fix Events load more
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski committed Mar 12, 2020
1 parent 79c4874 commit ff46c1f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const StyledResizable = styled(Resizable)`
flex-direction: column;
`;

const RESIZABLE_ENABLE = { left: true };

const FlyoutPaneComponent: React.FC<FlyoutPaneComponentProps> = ({
children,
flyoutHeight,
Expand Down Expand Up @@ -69,7 +71,6 @@ const FlyoutPaneComponent: React.FC<FlyoutPaneComponentProps> = ({
);
const resetLastDelta = useCallback(() => setLastDelta(0), [setLastDelta]);
const throttledResize = throttle(100, onResizeStop);
const resizableEnable = useMemo(() => ({ left: true }), []);
const resizableDefaultSize = useMemo(
() => ({
width,
Expand All @@ -95,7 +96,7 @@ const FlyoutPaneComponent: React.FC<FlyoutPaneComponentProps> = ({
size="l"
>
<StyledResizable
enable={resizableEnable}
enable={RESIZABLE_ENABLE}
defaultSize={resizableDefaultSize}
minWidth={minWidthPixels}
maxWidth={`${maxWidthPercent}vw`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { Sort } from '../sort';

import { Header } from './header';

const RESIZABLE_ENABLE = { right: true };

interface ColumneHeaderProps {
draggableIndex: number;
header: ColumnHeaderOptions;
Expand All @@ -39,7 +41,6 @@ const ColumnHeaderComponent: React.FC<ColumneHeaderProps> = ({
onFilterChange,
sort,
}) => {
const resizableEnable = useMemo(() => ({ right: true }), []);
const resizableSize = useMemo(
() => ({
width: header.width,
Expand Down Expand Up @@ -78,7 +79,7 @@ const ColumnHeaderComponent: React.FC<ColumneHeaderProps> = ({

return (
<Resizable
enable={resizableEnable}
enable={RESIZABLE_ENABLE}
size={resizableSize}
style={resizableStyle}
handleComponent={resizableHandleComponent}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const EventsComponent: React.FC<Props> = ({
getNotesByIds={getNotesByIds}
isEventPinned={eventIsPinned({ eventId: event._id, pinnedEventIds })}
isEventViewer={isEventViewer}
key={event._id}
key={`${event._id}_${event._index}`}
loadingEventIds={loadingEventIds}
maxDelay={maxDelay(i)}
onColumnResized={onColumnResized}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,18 +338,6 @@ export const FooterComponent = ({

FooterComponent.displayName = 'FooterComponent';

export const Footer = React.memo(
FooterComponent,
(prevProps, nextProps) =>
prevProps.compact === nextProps.compact &&
prevProps.hasNextPage === nextProps.hasNextPage &&
prevProps.height === nextProps.height &&
prevProps.isLive === nextProps.isLive &&
prevProps.isLoading === nextProps.isLoading &&
prevProps.itemsCount === nextProps.itemsCount &&
prevProps.itemsPerPage === nextProps.itemsPerPage &&
prevProps.itemsPerPageOptions === nextProps.itemsPerPageOptions &&
prevProps.serverSideEventCount === nextProps.serverSideEventCount
);
export const Footer = React.memo(FooterComponent);

Footer.displayName = 'Footer';
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { getOr } from 'lodash/fp';
import { getOr, uniqBy } from 'lodash/fp';
import memoizeOne from 'memoize-one';
import React from 'react';
import { Query } from 'react-apollo';
Expand Down Expand Up @@ -137,10 +137,10 @@ class TimelineQueryComponent extends QueryTemplate<
...fetchMoreResult.source,
Timeline: {
...fetchMoreResult.source.Timeline,
edges: [
edges: uniqBy('node._id', [
...prev.source.Timeline.edges,
...fetchMoreResult.source.Timeline.edges,
],
]),
},
},
};
Expand Down

0 comments on commit ff46c1f

Please sign in to comment.