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

Component exceeded time limit #5

Open
ghost opened this issue Mar 2, 2020 · 1 comment
Open

Component exceeded time limit #5

ghost opened this issue Mar 2, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Mar 2, 2020

I keep getting error messages on the switch component that says "Error in Switch.tsx Component exceeded time limit.". It is extremely frustration and slowing me down, because the error occurs every 5-10 minutes.

Any ideas or suggestions, or fixes would be greatly appreciated.

screenshot

@tisho
Copy link
Owner

tisho commented Mar 23, 2020

Framer has a "budget" for loading and rendering all code components in a project. The budget is shared across all components in your project (both your own and those from packages), so if any of them loads or renders a little bit slowly and blows through the budget, all other components will show the "exceeded time limit" message.

It’s important to note that Switch is a container component, and when placed on the canvas, all it does is re-render the Frame you’ve pointed it to. If there’s anything in that Frame that renders slowly, then the whole Switch component will exceed its time limit, even though it technically didn’t contribute to the “slowness”.

I know this can be incredibly frustrating, but unfortunately there's not much that can be done other than ensuring that components load and render as fast as possible. I'd recommend:

  1. Clean up unused packages
  2. Take a look at your own components and check if they're calling functions at the root level of the component, instead of just exporting components. If they're calling functions, see if you can make them work without the function calls
  3. See if you’re doing any particularly expensive work when rendering your components

Additionally, there's work I'm planning to do on the Switch side to make it load faster. Since there's a huge number of props on the component, I'm using a few helper functions to generate them at load time. I'll likely move those to be generated at build time, instead, so I can avoid any function calls at the root level of the component. Stay tuned for that update.

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

No branches or pull requests

1 participant