Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX Don't enter infinite loop when saving form #1329

Merged

Conversation

GuySartorelli
Copy link
Member

The code being changed was originally added in #1263 with the intention of ensuring the "draft" label is correctly removed when saving a DataObject which $owns the file relation.

I'm not sure exactly why the old code was causing an infinite loop, nor why this fixes it - but it does fix it. I haven't been able to force it to give me an infinite loop scenario with these changes.

Parent issue

Note that in the below reproduction steps any upload field in an entwine admin section will do. Bonus points if it has an $owns on the relation, so you can confirm the draft label is correctly updated.

Upload field issue (asset-admin + blog failure)

Looks like it's deep in react code, no idea how to fix, replication steps:

Behat failure was the first scenario in 'multi-file-upload-field.feature'

Probably broke as part of this commit - 6b95cde#diff-3a05b9a4144d39ff14fce903c8af69409262cd92732da975212e0e3d3a916e76 - though I'm not seeing much in UploadField.js that's obvious

  1. Use firefox (probably also debuggable in chrome, breaks the same in behat which uses chrome)
  2. cd vendor/silverstripe/admin && yarn install && yarn dev (so that you can debug the js. You can replicate issue with both yarn dev or yarn build)
  3. Go to /admin/test (requires framework test)
  4. Click on a company
  5. In the file upload field, select an image (behat test has 2x images, though also breaks with just 1x image)
  6. Save the form
  7. Browser will freeze
  8. Using firefox, click "Debug Script" when it pops up up the top
  9. You are now stuck in an infinite while loop deep in react code

react-dom-development.js:26465

I also arrive at the following while navigating around inside the while loop - workInProgress is undefined

image

I haven't confirmed, though I suspect the failure in https://github.com/silverstripe/silverstripe-blog/actions/runs/4109282020/jobs/7090944462 is the same, as it's timing out after clicking the "Publish button" after inserting a file from a gallery. The asset-admin failure is it timing out after clicking the "Save" button

@GuySartorelli
Copy link
Member Author

js CI errors are expected and will be fixed with silverstripe/silverstripe-admin#1421

Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested manually, works good

@emteknetnz emteknetnz merged commit 1bb852e into silverstripe:2 Feb 8, 2023
@emteknetnz emteknetnz deleted the pulls/2/fix-upload-issue branch February 8, 2023 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants