Skip to content

Commit

Permalink
Fix for broken intersect with updated API
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfisher72 committed Jul 10, 2024
1 parent be8f6d1 commit c1ff685
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
17 changes: 9 additions & 8 deletions screen2.0/src/app/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Link from "next/link"
import Image from "next/image"
import screenIcon from "../../public/screenLogo.png"
import { MainSearch } from "./_mainsearch/mainsearch"
import { A } from "logots-react"


/*
Expand Down Expand Up @@ -89,9 +90,9 @@ function ResponsiveAppBar() {
<Toolbar disableGutters sx={{ justifyContent: "space-between" }}>
{/* Logo, and desktop navigation */}
<Box display='flex' flexGrow={1}>
<Link href={"/"}>
<a href={"/"}>
<Image src={screenIcon} alt="SCREEN Icon" height={40} width={90} style={{marginRight: '20px'}}/>
</Link>
</a>
{/* Main navigation items for desktop, hide on small screen size */}
<Box sx={{ display: { xs: "none", lg: "flex" }, alignItems: 'center' }}>
{pageLinks.map((page) => (
Expand All @@ -107,11 +108,11 @@ function ResponsiveAppBar() {
onMouseEnter={page.subPages ? (event) => handleOpenNavMenu_Dropdown(event, page.dropdownID) : undefined}
>
{/* Wrap in next/link to enable dyanic link changing from basePath in next.config.js */}
<Link href={page.link}>
<a href={page.link}>
<Typography variant="body1">
{page.pageName}
</Typography>
</Link>
</a>
</Button>
{/* Create popup menu if page has subpages */}
{page.subPages && (
Expand Down Expand Up @@ -141,9 +142,9 @@ function ResponsiveAppBar() {
page.subPages.map((subPage) => (
<MenuItem key={subPage.pageName} onClick={() => handleCloseNavMenu_Dropdown(page.dropdownID)}>
{/* Wrap in next/link to enable dyanic link changing from basePath in next.config.js */}
<Link href={subPage.link}>
<a href={subPage.link}>
<Typography textAlign="center">{subPage.pageName}</Typography>
</Link>
</a>
</MenuItem>
))}
</Paper>
Expand Down Expand Up @@ -192,9 +193,9 @@ function ResponsiveAppBar() {
</MenuItem>
{pageLinks.map((page) => (
<MenuItem key={page.pageName} onClick={handleCloseNavMenu_Hamburger}>
<Link href={page.link}>
<a href={page.link}>
<Typography textAlign="center" textTransform="none">{page.pageName}</Typography>
</Link>
</a>
</MenuItem>
))}
</Menu>
Expand Down
8 changes: 5 additions & 3 deletions screen2.0/src/common/lib/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,10 @@ const cCRE_QUERY = gql`
}
`

function cCRE_QUERY_VARIABLES(assembly: string, chromosome: string, start: number, end: number, biosample: string, nearbygenesdistancethreshold: number, nearbygeneslimit: number, accessions: string[], noLimit?: boolean) {
function cCRE_QUERY_VARIABLES(assembly: string, coordinates: {chromosome: string, start: number, end: number}[], biosample: string, nearbygenesdistancethreshold: number, nearbygeneslimit: number, accessions: string[], noLimit?: boolean) {
let vars = {
uuid: null,
assembly: assembly,
coordinates: [{chromosome, start, end}],
gene_all_start: 0,
gene_all_end: 5000000,
gene_pc_start: 0,
Expand All @@ -149,6 +148,9 @@ function cCRE_QUERY_VARIABLES(assembly: string, chromosome: string, start: numbe
if (accessions) {
vars["accessions"] = accessions
}
if (coordinates) {
vars["coordinates"] = coordinates
}

return vars
}
Expand Down Expand Up @@ -259,7 +261,7 @@ export async function MainQuery(assembly: string = null, chromosome: string = nu
try {
data = await getClient().query({
query: cCRE_QUERY,
variables: cCRE_QUERY_VARIABLES(assembly, chromosome, start, end, biosample, nearbygenesdistancethreshold, nearbygeneslimit, accessions, noLimit),
variables: cCRE_QUERY_VARIABLES(assembly, chromosome ? [{chromosome, start, end}] : null, biosample, nearbygenesdistancethreshold, nearbygeneslimit, accessions, noLimit),
//Telling it to not cache, next js caches also and for things that exceed the 2mb cache limit it slows down substantially for some reason
fetchPolicy: "no-cache",
})
Expand Down

0 comments on commit c1ff685

Please sign in to comment.