Skip to content

Commit

Permalink
Merge pull request nasa-gcn#2223 from lpsinger/tns-internal-names
Browse files Browse the repository at this point in the history
Clean up TNS alternate event names
  • Loading branch information
dakota002 authored Apr 24, 2024
2 parents b53df2f + fd455c9 commit 461d274
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/routes/api.tooltip.tns.$.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ export async function loader({ params: { '*': value } }: LoaderFunctionArgs) {
if (!(ra && dec && names)) throw new Response(null, { status: 404 })

return json(
{ ra: ra.split(splitter), dec: dec.split(splitter), names },
{
ra: ra.split(splitter),
dec: dec.split(splitter),
// Some TNS events have values of `internal_names` that have an orphaned
// leading or trailing comma, such as `', PS24brk'`. Strip them out.
names: names.split(/\s*,\s*/).filter(Boolean),
},
{ headers: publicStaticShortTermCacheControlHeaders }
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function Tns({ children, value }: JSX.IntrinsicElements['data']) {
fetch={() => fetchTooltipData<typeof tnsTooltipLoader>('tns', value)}
label={({ ra, dec, names }) => (
<>
<div>{names}</div>
<div>{names.join(', ')}</div>
<div className={styles.ra}>
<span className={styles.h}>{ra[0]}</span>
<span className={styles.sep}>
Expand Down

0 comments on commit 461d274

Please sign in to comment.