Commit 17ab7152 authored by Imran Salam's avatar Imran Salam
Browse files

fix track panel bookmark links not loading on page reload

parent 018b2ab6
......@@ -36,7 +36,7 @@ const TrackPanelModal: FunctionComponent<TrackPanelModalProps> = (
case 'tracks-manager':
return <TracksManager />;
case 'bookmarks':
return <TrackPanelBookmarks exampleObjects={props.exampleObjects} />;
return <TrackPanelBookmarks />;
case 'personal-data':
return <PersonalData />;
case 'share':
......
import React, { FunctionComponent } from 'react';
import React, { useEffect } from 'react';
import { Link } from 'react-router-dom';
import { connect } from 'react-redux';
import { RootState } from 'src/store';
import { getExampleObjects } from 'src/content/app/browser/browserSelectors';
import { fetchExampleObjectsData } from 'src/content/app/browser/browserActions';
import styles from '../TrackPanelModal.scss';
type TrackPanelBookmarksProps = {
type StateProps = {
exampleObjects: any;
};
const TrackPanelBookmarks: FunctionComponent<TrackPanelBookmarksProps> = (
props: TrackPanelBookmarksProps
) => {
type DispatchProps = {
fetchExampleObjectsData: () => void;
};
type OwnProps = {};
type TrackPanelBookmarksProps = StateProps & DispatchProps & OwnProps;
export const TrackPanelBookmarks = (props: TrackPanelBookmarksProps) => {
const exampleObjectsTotal = Object.keys(props.exampleObjects).length;
useEffect(() => {
if (exampleObjectsTotal === 0) {
props.fetchExampleObjectsData();
}
}, [props.exampleObjects]);
const getExampleObjectNode = (exampleObject: any) => {
const {
assembly,
......@@ -52,4 +69,15 @@ const TrackPanelBookmarks: FunctionComponent<TrackPanelBookmarksProps> = (
);
};
export default TrackPanelBookmarks;
const mapStateToProps = (state: RootState) => ({
exampleObjects: getExampleObjects(state)
});
const mapDispatchToProps = {
fetchExampleObjectsData
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(TrackPanelBookmarks);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment