File tree Expand file tree Collapse file tree 2 files changed +18
-24
lines changed
Expand file tree Collapse file tree 2 files changed +18
-24
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import TanStackQueryProvider from "@/iconlogo/integrations/tanstack-query/root-p
77import { AppShell } from "@/iconlogo/features/editor/AppShell" ;
88
99const DEFAULT_PRESET_SHARE_ID = "QMfIxW" ;
10- const LOGO_STORE_KEY = "iconlogo-state" ;
1110
1211export default function IconLogoEditorClient ( ) {
1312 const [ sharedLogo , setSharedLogo ] = useState < LogoState | null > ( null ) ;
@@ -16,32 +15,27 @@ export default function IconLogoEditorClient() {
1615 const resolveSharedLogo = async ( ) => {
1716 const raw = new URLSearchParams ( window . location . search ) . get ( "s" ) ;
1817 if ( ! raw ) {
19- // On first-ever open, start from the curated preset.
20- if ( ! window . localStorage . getItem ( LOGO_STORE_KEY ) ) {
21- try {
22- const response = await fetch (
23- `/api/iconlogo/share/${ DEFAULT_PRESET_SHARE_ID } ` ,
24- {
25- method : "GET" ,
26- cache : "no-store" ,
27- } ,
28- ) ;
29-
30- if ( ! response . ok ) {
31- setSharedLogo ( null ) ;
32- return ;
33- }
18+ // Always start from the curated preset when no share id is provided.
19+ try {
20+ const response = await fetch ( `/api/iconlogo/share/${ DEFAULT_PRESET_SHARE_ID } ` , {
21+ method : "GET" ,
22+ cache : "no-store" ,
23+ } ) ;
3424
35- const data = ( await response . json ( ) ) as { logo ?: unknown } ;
36- if ( ! data . logo ) {
37- setSharedLogo ( null ) ;
38- return ;
39- }
25+ if ( ! response . ok ) {
26+ setSharedLogo ( null ) ;
27+ return ;
28+ }
4029
41- setSharedLogo ( sanitizeLogoState ( data . logo ) ) ;
42- } catch {
30+ const data = ( await response . json ( ) ) as { logo ?: unknown } ;
31+ if ( ! data . logo ) {
4332 setSharedLogo ( null ) ;
33+ return ;
4434 }
35+
36+ setSharedLogo ( sanitizeLogoState ( data . logo ) ) ;
37+ } catch {
38+ setSharedLogo ( null ) ;
4539 }
4640 return ;
4741 }
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ export function ShareButton() {
5757 const handleShareOnX = ( ) => {
5858 if ( ! shareUrl ) return ;
5959 const text = encodeURIComponent (
60- `Check out the logo I made with @enoughaashuu !\n\nEdit here: ${ shareUrl } ` ,
60+ `Check out the logo I made with @enoughaashuu!\n\nEdit here: ${ shareUrl } ` ,
6161 ) ;
6262 const url = `https://twitter.com/intent/tweet?text=${ text } ` ;
6363 window . open ( url , "_blank" ) ;
You can’t perform that action at this time.
0 commit comments