Skip to content

Commit

Permalink
Merge pull request #5 from carrawao/feature/watchlist
Browse files Browse the repository at this point in the history
SPF-18: fix watchlist screen not showing in other browsers
  • Loading branch information
carrawao authored Mar 31, 2022
2 parents a8a0ada + 6341766 commit 4447a3f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Frontend/src/components/screens/WatchLists/AssetsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const AssetsList = (props) => {
/>
);

return (
return props.watchListsArray.length > 0 && (
<Container className='pe-2 pe-xl-5'>
<Stack direction='row' alignItems='center' gap={1}>
<Typography variant='h6' noWrap>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const WatchListsScreen = (props) => {
<Grid container spacing={2}>
<Grid item className='col-sm-5 col-md-4'>
<WatchLists
{...props}
watchListsArray={props.watchListsArray}
setWatchListsArray={props.setWatchListsArray}
selectedListIndex={selectedListIndex}
Expand All @@ -32,7 +31,6 @@ const WatchListsScreen = (props) => {
</Grid>
<Grid item className='col-sm-12 col-md-8'>
<AssetsList
{...props}
watchListsArray={props.watchListsArray}
selectedListIndex={selectedListIndex}
/>
Expand Down
5 changes: 3 additions & 2 deletions Frontend/src/routes/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const SettingsScreen = lazy(() => import('../components/screens/Settings/Setting
*/
const persistState = (keyName, defaultValue) => {
const savedData = localStorage.getItem(keyName);
return savedData !== '' ? JSON.parse(savedData) : defaultValue;
console.log('savedData ==== ', savedData);
return !savedData ? JSON.parse(savedData) : defaultValue;
};

/**
Expand All @@ -29,7 +30,7 @@ const AppRoutes = () => {
const [watchListsArray, setWatchListsArray] = useState(() => persistState('watchListsArray', []));

useEffect(() => {
localStorage.setItem("watchListsArray", JSON.stringify(watchListsArray));
localStorage.setItem('watchListsArray', JSON.stringify(watchListsArray));
}, [watchListsArray]);

return (
Expand Down

0 comments on commit 4447a3f

Please sign in to comment.