-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Regression: requestAnimationFrame called in server environment #3324
Labels
Comments
It was actually #3016 that changed this. Reintroducing the |
In particular, it looks like my simplification is at fault here. I guess I didn't realize that the problem wasn't just that referring to rAF on the server was an error, but that we also wanted to be able to cope with calling the raf helper on the server. This doesn't break any tests: diff --git a/src/runtime/internal/environment.ts b/src/runtime/internal/environment.ts
index a1d50b55..71233991 100644
--- a/src/runtime/internal/environment.ts
+++ b/src/runtime/internal/environment.ts
@@ -1,10 +1,12 @@
+import { noop } from './utils';
+
export const is_client = typeof window !== 'undefined';
export let now: () => number = is_client
? () => window.performance.now()
: () => Date.now();
-export let raf = cb => requestAnimationFrame(cb);
+export let raf = is_client ? cb => requestAnimationFrame(cb) : noop;
// used internally for testing
export function set_now(fn) { |
Conduitry
added a commit
to Conduitry/sveltejs_svelte
that referenced
this issue
Aug 2, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
requestAnimationFrame
is called byspring
andtweened
(vialoop
) when components are rendered server-side. This makes it impossible to do this sort of thing......because it errors during rendering (since
requestAnimationFrame
is immediately called).This was fixed in #2856 but apparently undone in #2994 — @mrkishi, @Conduitry, just want to check this wasn't intentional before I update this?
Severity
Inconvenient
The text was updated successfully, but these errors were encountered: