theRAPTLab / gsgo

GEM-STEP Foundation repo migrated from GitLab June 2023
1 stars 1 forks source link

Bug Fix: "Save to Server" in Code view would redirect to Script Selection screen. - [merged] #733

Closed benloh closed 1 year ago

benloh commented 2 years ago

Merges dev-bl/fix-code-submit -> dev-next

The Problem

Upon sending a code update from the ScriptEditor's Code view, the ScriptEditor would not remain in Code view but instead would act as if the blueprint had been unselected and go back to the blueprint selection view.

Analysis

The problem stems from the use of the NET:SCRIPT_UPDATE call by ac-wizcore.ts. There were three handlers for NET:SCRIPT_UPDATE: project-server, Main, and ScriptEditor. Because ac-wizcore was making a UR.CallMessage, all three handlers would return a value. But only project-server was returning the correct value. Main and ScriptEditor were using the message simply to log a message that the script had been changed and not explicitly returning anything. The result is the returned value looked something like this: { { bpName: 'Algae'}, {} }. This was then passed on to SELECT_SCRIPT raised message, and since the data is now munged, SELECT_SCRIPT would make ScriptEditor think no blueprint was selected.

Solution

The fix was to split out the NET:SCRIPT_UPDATE call into the main data call, and a secondary NET:SCRIPT_UPDATED call that Main and ScriptEditor could handle separately. This makes sure the CallMessage doesn't end up with munged return values.

To Test

  1. Edit a blueprint
  2. Go to Code view
  3. Change some text.
  4. Click 'Save to Server'
  5. The ScriptEditor should remain with the selected script in the Code view.

If the ScripteEditor instead goes back to the script selection view, then this fix did not work.

benloh commented 2 years ago

requested review from @jdanish

benloh commented 2 years ago

@jdanish This isn't a super critical fix, but it was definitely odd behavior if you're editing in the code view all the time. Not super urgent for merging.

benloh commented 2 years ago

In GitLab by @jdanish on Oct 2, 2022, 05:43

I actually couldn't reproduce the error prior to pulling this. However, after getting it all seems fine with the various ways of saving code doing as expected.

benloh commented 2 years ago

mentioned in commit f619a9dd06cc8f210ad9bd4208e7e217818ea233