forked from MapComplete/MapComplete
		
	Studio: fix #2316
This commit is contained in:
		
							parent
							
								
									ff53354c96
								
							
						
					
					
						commit
						ceabc5573c
					
				
					 2 changed files with 15 additions and 14 deletions
				
			
		|  | @ -5,16 +5,18 @@ | |||
|   /** | ||||
|    * For some stupid reason, it is very hard to let {#if} work together with UIEventSources, so we wrap then here | ||||
|    */ | ||||
|   export let condition: Store<boolean> | ||||
|   let _c = condition.data | ||||
|   onDestroy( | ||||
|     condition.addCallback((c) => { | ||||
|       /* Do _not_ abbreviate this as `.addCallback(c => _c = c)`. This is the same as writing `.addCallback(c => {return _c = c})`,  | ||||
|     which will _unregister_ the callback if `c = true`! */ | ||||
|       _c = c | ||||
|       return false | ||||
|     }) | ||||
|   ) | ||||
|   export let condition: Store<boolean> | undefined | ||||
|   let _c = condition?.data | ||||
|   if (condition !== undefined) { | ||||
|     onDestroy( | ||||
|       condition.addCallback((c) => { | ||||
|         /* Do _not_ abbreviate this as `.addCallback(c => _c = c)`. This is the same as writing `.addCallback(c => {return _c = c})`, | ||||
|       which will _unregister_ the callback if `c = true`! */ | ||||
|         _c = c | ||||
|         return false | ||||
|       }) | ||||
|     ) | ||||
|   } | ||||
| </script> | ||||
| 
 | ||||
| {#if _c} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue