Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hellno committed Aug 23, 2023
1 parent 4bc4b45 commit 7225ff3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"esbuild": "^0.19.2",
"google-protobuf": "^3.21.2",
"javascript-time-ago": "^2.5.9",
"lodash.get": "^4.4.2",
"lodash.isempty": "^4.4.0",
"lodash.isequal": "^4.5.0",
"lodash.uniqby": "^4.7.0",
Expand Down
17 changes: 13 additions & 4 deletions src/pages/Feed/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AccountObjectType, useAccountStore } from "@/stores/useAccountStore";
import { CastType, VITE_NEYNAR_API_KEY } from "@/common/constants/farcaster";
import { useHotkeys } from "react-hotkeys-hook";
import uniqBy from 'lodash.uniqby';
import { open } from '@tauri-apps/api/shell';
import get from 'lodash.get';
import { CastRow } from "@/common/components/CastRow";
import { Key } from 'ts-key-enum';
import { openWindow } from "@/common/helpers/navigation";
Expand All @@ -26,10 +26,19 @@ export default function Feed() {
} = useAccountStore();

const selectedChannelParentUrl = channels && selectedChannelIdx !== null ? channels[selectedChannelIdx].parent_url : undefined;

const account: AccountObjectType = accounts[selectedAccountIdx];
const feedKey = selectedChannelParentUrl || (account && account.platformAccountId);
const feed = feedKey ? feeds[feedKey] : [];
const getFeedKey = ({ selectedChannelParentUrl, account }: { selectedChannelParentUrl: string | undefined, account: AccountObjectType }) => {
if (selectedChannelParentUrl) {
return selectedChannelParentUrl;
} else if (account) {
return account.platformAccountId;
} else {
return null;
}
};

const feedKey = getFeedKey({ selectedChannelParentUrl, account });
const feed = feedKey ? get(feeds, feedKey, []) : [];

const onSelectCast = (idx: number) => {
const cast = feed[idx];
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2963,6 +2963,11 @@ locate-path@^6.0.0:
dependencies:
p-locate "^5.0.0"

lodash.get@^4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
integrity sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==

lodash.isempty@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.isempty/-/lodash.isempty-4.4.0.tgz#6f86cbedd8be4ec987be9aaf33c9684db1b31e7e"
Expand Down

0 comments on commit 7225ff3

Please sign in to comment.