openlab-at-city-tech / webworkqa

WeBWorK integration for WordPress and BuddyPress
GNU General Public License v2.0
4 stars 2 forks source link

errors when immediately editing a question #101

Closed moui72 closed 7 years ago

moui72 commented 7 years ago

Tested with Windows 10 / Chrome 60+ http://openlabdev.org/webwork-playground/#:problemId=local/ComplexFractions-Method2/single-binomial-easy.pg:questionId=11081

When logged in as faculty, if I attempt to immediately edit a question I have just asked, I get errors.

The first time I edit, the editable fields appear as expected but they are empty. I get a javascript error on every keypress when typing in the editable fields. See below.

If I cancel my edit and then try to edit again, the editable fields disappear.

If I enter text and save, the text is updated as expected. The new text persists through reloads.

I would guess this is related to #87

JS Error (gets thrown on every keypress in the editable boxes)

index.js?ver=4.8-1.7.11:35631 Uncaught TypeError: Cannot read property 'replace' of undefined
    at PreviewableField.render (index.js?ver=4.8-1.7.11:35631)
    at index.js?ver=4.8-1.7.11:47998
    at measureLifeCyclePerf (index.js?ver=4.8-1.7.11:47278)
    at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (index.js?ver=4.8-1.7.11:47997)
    at ReactCompositeComponentWrapper._renderValidatedComponent (index.js?ver=4.8-1.7.11:48024)
    at ReactCompositeComponentWrapper._updateRenderedComponent (index.js?ver=4.8-1.7.11:47948)
    at ReactCompositeComponentWrapper._performComponentUpdate (index.js?ver=4.8-1.7.11:47926)
    at ReactCompositeComponentWrapper.updateComponent (index.js?ver=4.8-1.7.11:47847)
    at ReactCompositeComponentWrapper.receiveComponent (index.js?ver=4.8-1.7.11:47749)
    at Object.receiveComponent (index.js?ver=4.8-1.7.11:9409)
moui72 commented 7 years ago

Note that refreshing the page returns all behavior to normal

boonebgorges commented 7 years ago

Thanks for the detailed report! Editable fields require a separate way of storing data (so that the "cancel" button works), and I was neglecting to set that up properly after a new question is posted. This should now be fixed.

moui72 commented 7 years ago

yep!