mirror of https://github.com/sveltejs/svelte
				
				
				
			fix: take into account static blocks when determining transition locality (#17018)
	
		
	
				
					
				
			The "is this a transparent effect we can ignore" logic for determining whether or not to play a local transition didn't account for pruned block effects. This fix marks the child branch as transparent if the block effect was, and during traversal then checks if the branch is the child of a block - if not that means it's the child of a pruned block effect. fixes #16826pull/16200/merge
							parent
							
								
									86aedaecf9
								
							
						
					
					
						commit
						cd3a11edff
					
				@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					'svelte': patch
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fix: take into account static blocks when determining transition locality
 | 
				
			||||||
@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					import { flushSync } from 'svelte';
 | 
				
			||||||
 | 
					import { test } from '../../test';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default test({
 | 
				
			||||||
 | 
						async test({ assert, target }) {
 | 
				
			||||||
 | 
							const btn = target.querySelector('button');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							btn?.click();
 | 
				
			||||||
 | 
							flushSync();
 | 
				
			||||||
 | 
							assert.htmlEqual(
 | 
				
			||||||
 | 
								target.innerHTML,
 | 
				
			||||||
 | 
								`
 | 
				
			||||||
 | 
								<button>Toggle</button>
 | 
				
			||||||
 | 
								<div>Should not transition out</div>
 | 
				
			||||||
 | 
							`
 | 
				
			||||||
 | 
							);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							btn?.click();
 | 
				
			||||||
 | 
							flushSync();
 | 
				
			||||||
 | 
							assert.htmlEqual(target.innerHTML, '<button>Toggle</button>');
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					<script>
 | 
				
			||||||
 | 
						import { slide } from 'svelte/transition';
 | 
				
			||||||
 | 
						let showText = $state(false);
 | 
				
			||||||
 | 
						let show = $state(true);
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<button onclick={() => showText = !showText}>
 | 
				
			||||||
 | 
						Toggle
 | 
				
			||||||
 | 
					</button>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{#if showText}
 | 
				
			||||||
 | 
						{#if show}
 | 
				
			||||||
 | 
							<div transition:slide>
 | 
				
			||||||
 | 
								Should not transition out
 | 
				
			||||||
 | 
							</div>
 | 
				
			||||||
 | 
						{/if}
 | 
				
			||||||
 | 
					{/if}
 | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue