Skip to content
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

Support optional transitions #7352

Open
MathiasWP opened this issue Mar 9, 2022 · 1 comment
Open

Support optional transitions #7352

MathiasWP opened this issue Mar 9, 2022 · 1 comment

Comments

@MathiasWP
Copy link
Contributor

Describe the problem

It is possible to set transitions via props when creating Svelte components:

<script>
export let transition;
</script>

<p transition:transition|local>Hi!</p>

However, they cannot be optional:

<script>
export let transition = undefined;
</script>

<p transition:transition|local>Hi!</p>

Error thrown if transition is undefined:
Screenshot 2022-03-09 at 11 41 32

Describe the proposed solution

Check if transition is a function before running it.

The current implementation does not check if fn is of type "function"
Screenshot 2022-03-09 at 11 42 50

Alternatives considered

Setting a default empty empty function:

<script>
export let transition = () => {};
</script>

<p transition:transition|local>Hi!</p>

However, this is a potential memory leak until this pr is merged.

Importance

would make my life easier

@MathiasWP MathiasWP changed the title Support undefined transitions Support optional transitions Mar 10, 2022
@7antra
Copy link

7antra commented Apr 11, 2022

maybe duplication of #7157 ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants