File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,14 +65,17 @@ export async function createApp() {
6565 redirect ( "/builder/mock-new-id" ) ;
6666 }
6767
68- if ( ! userId ) throw new Error ( "Unauthorized" ) ;
68+ // Gracefully bounce unauthenticated 'Create New App' clicks to the sandbox
69+ if ( ! userId ) {
70+ redirect ( "/builder/template-blank" ) ;
71+ }
6972
7073 const { data, error } = await supabase
7174 . from ( "apps" )
7275 . insert ( {
7376 user_id : userId ,
7477 name : "Untitled App" ,
75- config : { app : "Untitled App" , pages : [ ] }
78+ config : { app : "Untitled App" , pages : [ ] } ,
7679 } )
7780 . select ( "id" )
7881 . single ( ) ;
Original file line number Diff line number Diff line change @@ -132,13 +132,26 @@ export default function BuilderPage() {
132132 // In production without bypass, this will eventually throw `Unauthorized` and redirect them.
133133 // In development with bypass, it will mock the save successfully.
134134 setIsSaving ( true ) ;
135+ // If not signed in, mock the save locally so guests can exhaust their interaction quota cleanly
136+ if ( ! isSignedIn ) {
137+ setTimeout ( ( ) => {
138+ setNotificationModal ( {
139+ type : "success" ,
140+ title : "Draft Saved Locally" ,
141+ message : "Guest changes are saved securely to your browser temporarily. Please sign in to deploy!" ,
142+ } ) ;
143+ setIsSaving ( false ) ;
144+ } , 500 ) ;
145+ return ;
146+ }
147+
135148 try {
136149 const res = await saveAppConfig ( appId , configStr ) ;
137150 if ( res && res . success === false ) throw new Error ( res . error ) ;
138151 setNotificationModal ( {
139152 type : "success" ,
140153 title : "Saved Successfully" ,
141- message : "Your draft has been saved securely." ,
154+ message : "Your draft has been saved securely to the database ." ,
142155 } ) ;
143156 } catch ( e : unknown ) {
144157 const msg = ( e as Error ) . message || "" ;
You can’t perform that action at this time.
0 commit comments