decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.81k stars 3.04k forks source link

Bug: Can not edit a post with 0.6 #778

Closed DirtyF closed 6 years ago

DirtyF commented 6 years ago

- Do you want to request a feature or report a bug?

🐛 Report a bug.

- What is the current behavior?

Can not edit any of the posts in the CMS since latest version. macOS High Sierra / latest Firefox 🦊

I thought it was related to CSP rules but it's currently report-only mode

- If the current behavior is a bug, please provide the steps to reproduce.

Click on a post on the dashboard. Get a blank screen, open the console and see this message:

Checking for MetaData files

cms.js:70:111260
 2017-10-03-interview-hugo-lead-developer does not have metadata
cms.js:70:111583
Invariant Violation: Minified React error #40; visit http://facebook.github.io/react/docs/error-decoder.html?invariant=40 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
Stack trace:
r@https://unpkg.com/netlify-cms/dist/cms.js:163:58452
unmountComponentAtNode@https://unpkg.com/netlify-cms/dist/cms.js:163:163295
value@https://unpkg.com/netlify-cms/dist/cms.js:754:121371
l@https://unpkg.com/netlify-cms/dist/cms.js:163:83842
i@https://unpkg.com/netlify-cms/dist/cms.js:163:82924
a@https://unpkg.com/netlify-cms/dist/cms.js:163:83364
commitDeletion@https://unpkg.com/netlify-cms/dist/cms.js:163:85136
n@https://unpkg.com/netlify-cms/dist/cms.js:163:89650
u@https://unpkg.com/netlify-cms/dist/cms.js:163:91520
c@https://unpkg.com/netlify-cms/dist/cms.js:163:91963
m@https://unpkg.com/netlify-cms/dist/cms.js:163:93985
h@https://unpkg.com/netlify-cms/dist/cms.js:163:93494
enqueueSetState@https://unpkg.com/netlify-cms/dist/cms.js:163:74761
o.prototype.setState@https://unpkg.com/netlify-cms/dist/cms.js:163:50770
u/</r</l.prototype.handleChange@https://unpkg.com/netlify-cms/dist/cms.js:163:173824
c@https://unpkg.com/netlify-cms/dist/cms.js:70:67221
r/</<@https://unpkg.com/netlify-cms/dist/cms.js:70:91361
r/</<@https://unpkg.com/netlify-cms/dist/cms.js:163:198161
dispatch@https://unpkg.com/netlify-cms/dist/cms.js:163:179939
_/<@https://unpkg.com/netlify-cms/dist/cms.js:29:20602
r/</<@https://unpkg.com/netlify-cms/dist/cms.js:163:198154
dispatch@https://unpkg.com/netlify-cms/dist/cms.js:163:179939
v/</<@https://unpkg.com/netlify-cms/dist/cms.js:29:106426
Async*v/<@https://unpkg.com/netlify-cms/dist/cms.js:29:106291
r/</<@https://unpkg.com/netlify-cms/dist/cms.js:163:198154
n/a.loadEntry@https://unpkg.com/netlify-cms/dist/cms.js:754:130576
value@https://unpkg.com/netlify-cms/dist/cms.js:181:162512
commitLifeCycles@https://unpkg.com/netlify-cms/dist/cms.js:163:85747
n@https://unpkg.com/netlify-cms/dist/cms.js:163:89854
u@https://unpkg.com/netlify-cms/dist/cms.js:163:91520
c@https://unpkg.com/netlify-cms/dist/cms.js:163:91963
batchedUpdates@https://unpkg.com/netlify-cms/dist/cms.js:163:94825
T@https://unpkg.com/netlify-cms/dist/cms.js:163:62076
_@https://unpkg.com/netlify-cms/dist/cms.js:163:62012
batchedUpdates@https://unpkg.com/netlify-cms/dist/cms.js:163:109600
dispatchEvent@https://unpkg.com/netlify-cms/dist/cms.js:163:110449
EventListener.handleEvent*listen@https://unpkg.com/netlify-cms/dist/cms.js:163:164348
trapBubbledEvent@https://unpkg.com/netlify-cms/dist/cms.js:163:109999
listenTo@https://unpkg.com/netlify-cms/dist/cms.js:163:114681
q@https://unpkg.com/netlify-cms/dist/cms.js:163:65928
setInitialProperties@https://unpkg.com/netlify-cms/dist/cms.js:163:125942
finalizeInitialChildren@https://unpkg.com/netlify-cms/dist/cms.js:163:161021
completeWork@https://unpkg.com/netlify-cms/dist/cms.js:163:81797
o@https://unpkg.com/netlify-cms/dist/cms.js:163:90395
i@https://unpkg.com/netlify-cms/dist/cms.js:163:91011
u@https://unpkg.com/netlify-cms/dist/cms.js:163:91488
c@https://unpkg.com/netlify-cms/dist/cms.js:163:91963
m@https://unpkg.com/netlify-cms/dist/cms.js:163:93985
h@https://unpkg.com/netlify-cms/dist/cms.js:163:93494
enqueueSetState@https://unpkg.com/netlify-cms/dist/cms.js:163:74761
o.prototype.setState@https://unpkg.com/netlify-cms/dist/cms.js:163:50770
u/</r</l.prototype.handleChange@https://unpkg.com/netlify-cms/dist/cms.js:163:173824
c@https://unpkg.com/netlify-cms/dist/cms.js:70:67221
r/</<@https://unpkg.com/netlify-cms/dist/cms.js:70:91361
r/</<@https://unpkg.com/netlify-cms/dist/cms.js:163:198161
dispatch@https://unpkg.com/netlify-cms/dist/cms.js:163:179939
u/<@https://unpkg.com/netlify-cms/dist/cms.js:29:36363
r/</<@https://unpkg.com/netlify-cms/dist/cms.js:163:198154
dispatch@https://unpkg.com/netlify-cms/dist/cms.js:163:179939
c/</<@https://unpkg.com/netlify-cms/dist/cms.js:29:36652
promise callback*c/<@https://unpkg.com/netlify-cms/dist/cms.js:29:36450
r/</<@https://unpkg.com/netlify-cms/dist/cms.js:163:198154
value@https://unpkg.com/netlify-cms/dist/cms.js:181:21897
commitLifeCycles@https://unpkg.com/netlify-cms/dist/cms.js:163:85747
n@https://unpkg.com/netlify-cms/dist/cms.js:163:89854
u@https://unpkg.com/netlify-cms/dist/cms.js:163:91520
c@https://unpkg.com/netlify-cms/dist/cms.js:163:91963
m@https://unpkg.com/netlify-cms/dist/cms.js:163:93985
h@https://unpkg.com/netlify-cms/dist/cms.js:163:93494
updateContainer@https://unpkg.com/netlify-cms/dist/cms.js:163:159930
pt/<@https://unpkg.com/netlify-cms/dist/cms.js:163:101189
unbatchedUpdates@https://unpkg.com/netlify-cms/dist/cms.js:163:94899
pt@https://unpkg.com/netlify-cms/dist/cms.js:163:101158
render@https://unpkg.com/netlify-cms/dist/cms.js:163:163122
@https://unpkg.com/netlify-cms/dist/cms.js:163:47636
t@https://unpkg.com/netlify-cms/dist/cms.js:1:341
@https://unpkg.com/netlify-cms/dist/cms.js:1:703
@https://unpkg.com/netlify-cms/dist/cms.js:1:247
@https://unpkg.com/netlify-cms/dist/cms.js:1:219
@https://unpkg.com/netlify-cms/dist/cms.js:1:2
cms.js:163:93262
Error: Minified React error #40; visit http://facebook.github.io/react/docs/error-decoder.html?invariant=40 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
cms.js:163:58452

- What is the expected behavior?

Being able to edit the post.

- Please mention your CMS, node.js, and operating system version.

Latest version : 0.6

erquhart commented 6 years ago

@DirtyF we haven't seen other reports of this, can you provide steps to reproduce?

DirtyF commented 6 years ago

This only happens with latest Firefox, can not reproduce the problem with latest Google Chrome.

netlify-cms-firefox

Of course the file contains metadata, but this error keep showing in the console :

 Checking for MetaData files cms.js:70:111260
erquhart commented 6 years ago

Firefox stable?

DirtyF commented 6 years ago

Tested with Firefox 56.0.2 (stable) and Firefox Nightly, both display the same error.

erquhart commented 6 years ago

Boom, got it. Not present in 56.0.1, but it's there in 56.0.2. Investigating.

tech4him1 commented 6 years ago

With that "does not have metadata" error, is this only happening in Editorial Workflow?

erquhart commented 6 years ago

That's actually just a console log, not an error. Debugging in FF is pretty rough, console logging my way through it now.

erquhart commented 6 years ago

Seems to be generating from this guy:

https://github.com/ryanseddon/react-frame-component

Benaiah commented 6 years ago

@erquhart that's also what I'm seeing. My current repro uses the following steps:

Gonna test with the simple workflow to see if that affects it (I suspect the error isn't dependent on workflow, though).

EDIT: error does not show up in the simple workflow with the same set of steps (minus the EW-specific stuff)

erquhart commented 6 years ago

I'm seeing it just opening any entry from the collection page on an EW implementation.

erquhart commented 6 years ago

Playing with a local version of react-frame-component now, although it's telling that this bug doesn't surface if you load the entry directly by url.

tech4him1 commented 6 years ago

Weird, I saw that error before when I was upgrading React 16, but then I couldn't repro it again in Chrome, so I thought it was fixed.

it's telling that this bug doesn't surface if you load the entry directly by url.

@erquhart That was the case I was seeing it in as well.

Benaiah commented 6 years ago

I'd definitely like an error boundary around the preview frame - preview errors shouldn't break the application entirely, especially since end users can insert their own code there.

erquhart commented 6 years ago

Submitting a PR to react-frame-component. If we can't get a super quick release from them we'll use a temporary fork to bridge the gap tomorrow.

@DirtyF for now, the best workaround is either use a different browser or refresh the page after the entry fails to load.

tech4him1 commented 6 years ago

@Benaiah The preview frame is technically an iframe, so I don't any errors would actually escape it or interfere with React. Or am I mistaken there?

erquhart commented 6 years ago

We interact with the preview via context, so it is possible.

erquhart commented 6 years ago

@DirtyF update: going to do what @Benaiah suggested and build our first Error Boundary around the preview iframe, something we need to start doing across the app anyway. PR forthcoming.

DirtyF commented 6 years ago

@erquhart 👌 Thanks for the update. Looking forward to use v1.0 with Firefox Quantum 🦊 🏁 🎊

erquhart commented 6 years ago

Quantum looks awesome, did not know about that!

In other news, the issue is no longer occurring when the error boundary is in place, which confirms my suspicion that it's a race condition. Still, not considering this closed until the lib fix is released, but this will help. Even if the preview throws, the rest of the page is still active, and you can edit and save sans preview (or just refresh).

Releasing soon.

DirtyF commented 6 years ago

You rock. 🎸

erquhart commented 6 years ago

Update: fix merged a while back, just waiting on release. Going to go ahead and close since this is effectively fixed and we're just waiting for a release that will be automatically pulled in to cms deps.