MLH-Fellowship / babel-sandbox

Babel repl-like codesandbox: check out link =>
https://codesandbox.io/s/github/babel/sandboxes
MIT License
6 stars 3 forks source link

Fix bug: plugin scripts being added every page load #107

Closed garrettluu closed 4 years ago

garrettluu commented 4 years ago

Closes #81.

Plugins are still registered with every rerender of App.js. Currently, the function call looks like this:

useEffect(() => {
    registerDefaultPlugins();
});

Changing it to this would theoretically fix the problem, since it would only be called on the first render:

useEffect(() => {
    registerDefaultPlugins();
}, []);

but for some reason the plugins all become undefined and everything breaks. (Is this bug even worth fixing?) image

barronwei commented 4 years ago

What do you mean by the plugins become undefined?

barronwei commented 4 years ago

Can you try doing

  useEffect(() => {
    importDefaultPlugins();
    registerDefaultPlugins();
  }, []);
garrettluu commented 4 years ago

Probably gonna close this once #113 gets done