-
Notifications
You must be signed in to change notification settings - Fork 19
feat(onboarding): seed the catalog when the first artist is added in setup (chat#1889 row 8) #1900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c7d544d
0c88924
2f6aee0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ import { useState } from "react"; | |
| import { Plus } from "lucide-react"; | ||
| import { Button } from "@/components/ui/button"; | ||
| import SpotifyArtistSearch from "@/components/Artists/SpotifyArtistSearch"; | ||
| import { useAddRosterArtist } from "@/hooks/onboarding/useAddRosterArtist"; | ||
| import { useAddSpotifyArtist } from "@/hooks/useAddSpotifyArtist"; | ||
| import type { SpotifyArtistSearchResult } from "@/types/spotify"; | ||
|
|
||
| /** | ||
|
|
@@ -15,16 +15,19 @@ import type { SpotifyArtistSearchResult } from "@/types/spotify"; | |
| * structurally unreachable for anyone who arrived without a funnel valuation | ||
| * (chat#1889). Picking a real Spotify artist resolves the id, profile URL, and | ||
| * avatar in one step, reusing the same typeahead as verify-socials (chat#1882). | ||
| * | ||
| * Adds through `useAddSpotifyArtist` — the same hook the `/artists` dialog uses | ||
| * — because it also kicks `POST /api/valuation` for the picked artist when the | ||
| * account has no catalog yet. Without that seeding an account onboarded here | ||
| * finished setup with nothing to value, so the reward on the completion panel | ||
| * could only ever render its "Claim your catalog" fallback (chat#1889 row 8). | ||
| */ | ||
| const AddArtistForm = () => { | ||
| const { addArtist, isAdding } = useAddRosterArtist(); | ||
| const { add, isAdding } = useAddSpotifyArtist(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Switching AddArtistForm to useAddSpotifyArtist means catalog seeding now depends on catalogsQuery having already resolved ( Prompt for AI agentsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a valuation-funnel account already has a catalog and uses this setup form to add another artist, this swapped-in hook also selects and persists the newly created artist via Useful? React with 👍 / 👎. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Switching AddArtistForm to useAddSpotifyArtist means adding a second artist during setup will select and persist that new artist via getArtists, but useAddSpotifyArtist only triggers POST /api/valuation for the first artist when no catalog exists yet. If an account already has a catalog and baseline valuation, adding another artist here selects it without any valuation, and since useHomeValuation scopes results to the selected artist, the previously-computed baseline valuation would disappear from the done panel / /setup/valuation. Consider refreshing without changing the selection, or restoring the prior selection after the add when a catalog already exists. Prompt for AI agents |
||
| const [isOpen, setIsOpen] = useState(false); | ||
|
|
||
| const handleSelect = async (artist: SpotifyArtistSearchResult) => { | ||
| const added = await addArtist(artist.name, { | ||
| profileUrl: artist.external_urls.spotify, | ||
| image: artist.images?.[0]?.url, | ||
| }); | ||
| const added = await add(artist); | ||
| if (added) setIsOpen(false); | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| "use client"; | ||
|
|
||
| import Link from "next/link"; | ||
| import { buttonVariants } from "@/components/ui/button"; | ||
| import { cn } from "@/lib/utils"; | ||
|
|
||
| /** | ||
| * Terminal state for `/setup/valuation` while a catalog exists but has no | ||
| * valuation yet. | ||
| * | ||
| * Seeding (chat#1889 row 8) creates the catalog seconds after the first artist | ||
| * is added and its measurements land later, so this window is routine. Without | ||
| * a state of its own the route could neither redirect (there IS a catalog) nor | ||
| * render the hero, and sat on a skeleton with no exit. | ||
| */ | ||
| const MeasuringCatalogPanel = () => ( | ||
| <section className="mx-auto flex w-full max-w-xl flex-col items-center gap-4 px-6 py-8 text-center"> | ||
| <h1 className="text-2xl font-semibold text-foreground"> | ||
| Measuring your catalog | ||
| </h1> | ||
| <p className="text-sm text-muted-foreground"> | ||
| We are pulling play counts for every track. This usually takes a minute. | ||
| Your baseline value appears here as soon as it is ready. | ||
| </p> | ||
| <Link href="/setup/tasks" className={cn(buttonVariants(), "min-w-[200px]")}> | ||
| Set up your weekly report | ||
| </Link> | ||
| </section> | ||
| ); | ||
|
|
||
| export default MeasuringCatalogPanel; |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
/setup/artistsis opened directly and the user selects an artist beforeuseCatalogs()has resolved, this swapped-in hook reports success but never startsrunValuation:useAddSpotifyArtistonly seeds whencatalogsQuery.data?.catalogsis already a defined empty array, whileConfirmRosterSteprenders this form without waiting for that query. That leaves cold-start setup users in the same no-catalog fallback this change is meant to eliminate, so the add flow should wait/refetch until catalog state is known before deciding whether to seed.Useful? React with 👍 / 👎.