Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parts Browser: Run queued changes in reverse (#2387)
This prevents an edge case I encountered where the following occurs: - The user creates a new part, and forgets to add certain info (in my case, I forgot to check the "RP-1" box), and presses "Queue Changes" - The user edits that part - The user presses "Commit to JSON" - Operation fails, console shows exception: ``` Traceback (most recent call last): File "flask\app.py", line 2190, in wsgi_app File "flask\app.py", line 1486, in full_dispatch_request File "flask\app.py", line 1484, in full_dispatch_request File "flask\app.py", line 1469, in dispatch_request File "app.py", line 168, in commit_changes part_data.add_new_part(part) File "part_data.py", line 25, in add_new_part print(f'Adding new part with name: {new_part["name"]}') ~~~~~~~~^^^^^^^^ KeyError: 'name' ``` This is because the "edit" queued change is executed before the part is even created, causing issues. Running queued changes in reverse should prevent any issues with this in most cases, assuming the browser/frontend is sane and does not randomly order queued changes.
- Loading branch information