Skip to content

Commit

Permalink
Fixed news component filter
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Dec 11, 2023
1 parent 17af7ef commit fdbdb67
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/node/stanford-news/page-display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {redirect} from "next/navigation";

const StanfordNews = async ({node, ...props}: { node: News }) => {
node.su_news_components = await fetchComponents<StanfordParagraph>(node.su_news_components || [])
node.su_news_components = node.su_news_components.filter(item => !item?.id);
node.su_news_components = node.su_news_components.filter(item => !!item?.id);

// Redirect the user to the external source.
if (node.su_news_source?.url && node.su_news_source?.url?.length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/fetch-components.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {getResource} from "@/lib/drupal/get-resource";
import {JsonApiResource} from "next-drupal";

async function fetchComponents<T>(components: JsonApiResource[], options = {}):Promise<T[]> {
const fetchComponents = async <T, >(components: JsonApiResource[], options = {}): Promise<T[]> => {
const requests: PromiseLike<any>[] = [];
components.map(component => requests.push(getResource(component.type, component.id, options)));

Expand Down

1 comment on commit fdbdb67

@vercel
Copy link

@vercel vercel bot commented on fdbdb67 Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.