kodemoapp / player

A React component for reading Kodemo documents.

Home Page:https://kodemo.com/docs/player

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Codesandbox detects loop iterating more than 10000 times at import

y-nk opened this issue · comments

Reproducible example: https://codesandbox.io/s/mutable-brook-7r4tru?file=/src/App.js

Steps to reproduce:

  1. Create a sandbox with CRA template
  2. Install @kodemo/player
  3. Export the sample story from the kodemo editor as a json file
  4. Feed the player from 2. with the story from 3. It should give something like:
    import React from "react";
    import "./App.css";
    
    import { KodemoPlayer } from "@kodemo/player"; // ← breaks here
    import json from "./story.json";
    
    function App() {
      return (
        <div className="App">
          {/*<KodemoPlayer json={json} />*/}  // ← nothing rendered here
        </div>
      );
    }
    
    export default App;

Current result:

image

Current fix:

You can remove this check by creating a sandbox.config.json and add "infiniteLoopProtection": false and it works... although i'm thinking something's not right to have 10k loop iteration on import.

Expected result:

I'm thinking importing a module should not directly execute code. I'm not really sure if it's a codesandbox issue or a kodemo issue, but there's definitely something worth reporting.