vankop / jsoneditor-react

react wrapper implementation for https://github.com/josdejong/jsoneditor
MIT License
265 stars 106 forks source link

Issue when deployed #27

Closed jvallar closed 4 years ago

jvallar commented 4 years ago

I am using CRA. it works on development localhost, but shows error when deployed to production. Please check below

import { JsonEditor as Editor } from 'jsoneditor-react';
import 'jsoneditor-react/es/editor.min.css';
import 'brace';
import 'brace/mode/json';
import 'brace/theme/github';
...
        <Editor
            style={{height: 500}}
            value={app.data}
            search={false}
            mode={'code'}
            enableSort={false}
            enableTransform={false}
            history={false}
            onChange={this.handleJSONChange}
        />
jsoneditor-minimalist.js:8204 Uncaught TypeError: e.canUndo is not a function
    at v.g._updateHistoryButtons (jsoneditor-minimalist.js:8204)
    at v.g.create (jsoneditor-minimalist.js:8084)
    at v.setMode (jsoneditor-minimalist.js:12705)
    at v._create (jsoneditor-minimalist.js:12608)
    at new v (jsoneditor-minimalist.js:12571)
    at t.value (index.js:324)
    at t.value (index.js:255)
    at react-dom.production.min.js:6324
    at t.unstable_runWithPriority (scheduler.production.min.js:270)
    at qi (react-dom.production.min.js:2794)
react-dom.production.min.js:4636 TypeError: e.canUndo is not a function
    at v.g._updateHistoryButtons (jsoneditor-minimalist.js:8204)
    at v.g.create (jsoneditor-minimalist.js:8084)
    at v.setMode (jsoneditor-minimalist.js:12705)
    at v._create (jsoneditor-minimalist.js:12608)
    at new v (jsoneditor-minimalist.js:12571)
    at t.value (index.js:324)
    at t.value (index.js:255)
    at react-dom.production.min.js:6324
    at t.unstable_runWithPriority (scheduler.production.min.js:270)
    at qi (react-dom.production.min.js:2794)
vankop commented 4 years ago

Hi! You need to create minimal reproductionable repo and create issue in upstream jsoneditor dependency

jvallar commented 4 years ago

I realized the new jsoneditor version 8.5.0 breaks this module.

vankop commented 4 years ago

you mean jsoneditor-react is incompatible with jsoneditor@8.5.0 ?

jvallar commented 4 years ago

Yes, I reported it https://github.com/josdejong/jsoneditor/issues/892. I think they did some fixing.