Skip to content

Commit db9a9fd

Browse files
camielvsclaude
andcommitted
address pr feedback
- Render OnboardingHero once, drive placement via CSS order toggle - Document why derived onboarding steps don't emit step.completed - Reconcile onboarding progress cache on PATCH failure via onError Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ac3871e commit db9a9fd

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/components/Learn/OnboardingHero.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Button } from "@/components/ui/button";
33
import { Icon } from "@/components/ui/icon";
44
import { BlockStack, InlineStack } from "@/components/ui/layout";
55
import { Heading, Paragraph } from "@/components/ui/typography";
6+
import { cn } from "@/lib/utils";
67
import { useOnboarding } from "@/providers/OnboardingProvider/OnboardingProvider";
78

89
function scrollNearestScrollableToTop(el: HTMLElement | null) {
@@ -21,12 +22,15 @@ function scrollNearestScrollableToTop(el: HTMLElement | null) {
2122
window.scrollTo({ top: 0, behavior: "smooth" });
2223
}
2324

24-
export function OnboardingHero() {
25+
export function OnboardingHero({ className }: { className?: string }) {
2526
const { isComplete, dismissed, dismiss, reopen } = useOnboarding();
2627

2728
if (dismissed) {
2829
return (
29-
<InlineStack align="end" className="text-muted-foreground opacity-50">
30+
<InlineStack
31+
align="end"
32+
className={cn("text-muted-foreground opacity-50", className)}
33+
>
3034
<Button
3135
variant="ghost"
3236
size="sm"
@@ -46,7 +50,12 @@ export function OnboardingHero() {
4650
}
4751

4852
return (
49-
<div className="relative rounded-xl border border-border bg-linear-to-br from-primary/5 to-transparent p-6">
53+
<div
54+
className={cn(
55+
"relative rounded-xl border border-border bg-linear-to-br from-primary/5 to-transparent p-6",
56+
className,
57+
)}
58+
>
5059
<Button
5160
variant="ghost"
5261
size="icon"

src/providers/OnboardingProvider/onboardingProgress.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ export function usePersistOnboardingProgress() {
9898
method: "PATCH",
9999
headers: { "Content-Type": "application/json" },
100100
body: JSON.stringify({ settings: { [ONBOARDING_KEY]: next } }),
101-
// Often fired just before a navigation/reload; survive page unload.
102101
keepalive: true,
103102
});
104103
},
104+
onError: () => {
105+
queryClient.invalidateQueries({ queryKey: queryKey(backendUrl) });
106+
},
105107
});
106108

107109
return (next: OnboardingProgress) => {

src/routes/Dashboard/Learn/LearnHomeView.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function LearnHomeView() {
2626
</BlockStack>
2727
</BlockStack>
2828

29-
{!dismissed && <OnboardingHero />}
29+
<OnboardingHero className={dismissed ? "order-last" : undefined} />
3030

3131
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
3232
<TipOfTheDay />
@@ -43,8 +43,6 @@ export function LearnHomeView() {
4343
<HelpCard />
4444
</div>
4545
</div>
46-
47-
{dismissed && <OnboardingHero />}
4846
</BlockStack>
4947
);
5048
}

0 commit comments

Comments
 (0)