File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed
packages/app/src/app/overmind/namespaces/profile Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,17 @@ export const profileMounted = withLoadApp(
2020
2121 state . profile . profiles [ profile . id ] = profile ;
2222 state . profile . currentProfileId = profile . id ;
23+
24+ if ( profile . showcasedSandboxShortid ) {
25+ try {
26+ state . profile . showcasedSandbox = await effects . api . getSandbox (
27+ profile . showcasedSandboxShortid
28+ ) ;
29+ } catch ( e ) {
30+ // Ignore it
31+ }
32+ }
33+
2334 state . profile . isLoadingProfile = false ;
2435 }
2536) ;
@@ -136,8 +147,11 @@ export const newSandboxShowcaseSelected = async (
136147 return ;
137148 }
138149
139- await effects . api . updateShowcasedSandbox ( state . user . username , id ) ;
140-
150+ const sandbox = await effects . api . updateShowcasedSandbox (
151+ state . user . username ,
152+ id
153+ ) ;
154+ state . profile . showcasedSandbox = sandbox as Sandbox ;
141155 state . profile . isLoadingProfile = false ;
142156} ;
143157
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ export const state: State = {
7272 currentSortDirection : 'desc' ,
7373 contextMenu : { sandboxId : null , sandboxType : null , position : null } ,
7474 collections : [ ] ,
75+ showcasedSandbox : null ,
7576 isProfileCurrentUser : derived (
7677 ( currentState : State , rootState : Context [ 'state' ] ) =>
7778 Boolean (
@@ -83,11 +84,7 @@ export const state: State = {
8384 ? currentState . profiles [ currentState . currentProfileId ]
8485 : null
8586 ) ,
86- showcasedSandbox : derived ( ( currentState : State ) =>
87- currentState . current && currentState . current . showcasedSandboxShortid
88- ? currentState . sandboxes . all [ currentState . current . showcasedSandboxShortid ]
89- : null
90- ) ,
87+
9188 currentLikedSandboxes : derived ( ( currentState : State ) =>
9289 currentState . current
9390 ? currentState . likedSandboxes [ currentState . current . username ]
You can’t perform that action at this time.
0 commit comments