Skip to content

Implement local transitions #2008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 27, 2019
Merged

Implement local transitions #2008

merged 5 commits into from
Jan 27, 2019

Conversation

Rich-Harris
Copy link
Member

@Rich-Harris Rich-Harris commented Jan 27, 2019

I was dreading this task but it turned out to be fairly simple. With this change, we call .i() and .o() methods on fragments with a 1 argument if the change is local (i.e. the call is in a p aka update method). Then, local transitions are wrapped in an if (local) ... block.

Local transitions present an opportunity to generate more optimal code — in a situation like this...

{#if x}
  {#if y}
    <div in:foo|local>...</div>
  {/if}
{/if}

...the outer block doesn't need any transition code at all. Am in two minds about whether to try and implement that now or worry about it later.

This PR is dedicated to @jacwright 😀

@codecov-io
Copy link

codecov-io commented Jan 27, 2019

Codecov Report

Merging #2008 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #2008   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files           1       1           
  Lines          48      48           
======================================
  Hits           48      48

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ebd0b5e...229ae21. Read the comment docs.

This was referenced Jan 27, 2019
@Rich-Harris Rich-Harris merged commit eccc8b2 into master Jan 27, 2019
@Rich-Harris Rich-Harris deleted the gh-1480 branch January 27, 2019 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants