Skip to content

Commit

Permalink
fix: dont run parallel load functions when layout data fails
Browse files Browse the repository at this point in the history
  • Loading branch information
moonlitgrace committed Dec 21, 2024
1 parent 7319fde commit 7018e0c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/apps/quiblet/api/v1/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_object(self) -> Quiblet: # pyright: ignore

if not obj:
raise exceptions.NotFound(
f'Quiblet with name {self.kwargs[self.lookup_field]} not found.'
f'Quiblet with name <b>{self.kwargs[self.lookup_field]}</b> not found.'
)
return obj

Expand Down
6 changes: 5 additions & 1 deletion frontend/src/routes/(app)/q/+error.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
import { page } from '$app/stores';
</script>

<svelte:head>
<title>Quiblet not found</title>
</svelte:head>

<div class="mt-5 flex flex-1 items-end justify-center gap-5">
<img src={Quibble404} class="w-28" alt="" />
<div class="flex flex-col">
<h4 class="text-xl font-bold text-error">oh noh!!</h4>
<h5 class="text-error">{$page.error?.message}</h5>
<h5>{@html $page.error?.message}</h5>

Check failure on line 14 in frontend/src/routes/(app)/q/+error.svelte

View workflow job for this annotation

GitHub Actions / lint

`{@html}` can lead to XSS attack
<a href="/" aria-label="home" class="btn btn-primary btn-sm mt-4 w-max">
<coreicons-shape-home class="size-4"></coreicons-shape-home>
Back to home
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/routes/(app)/q/[name]/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import client from '$lib/clients/client';
import type { PageServerLoad } from './$types';

export const load: PageServerLoad = async ({ params }) => {
export const load: PageServerLoad = async ({ params, parent }) => {
await parent();

const [quibs, highlighted_quibs] = await Promise.all([
client.GET('/api/v1/quiblets/{name}/quibs/', {
params: {
Expand Down

0 comments on commit 7018e0c

Please sign in to comment.