eternagame / EternaJS

Eterna game/RNA design interface
Other
12 stars 10 forks source link

Fix crash/update failure with constraints requiring dotplots when loading a cached design #808

Closed luxaritas closed 3 months ago

luxaritas commented 3 months ago

Summary

Previously, when switching between designs with next/previous, constraints like the confidence constraint which requires the dot plot to be computed would fail to update - and in fact, throw an error and not complete the solution load process - without a cached dot plot in the loaded solution.

Implementation Notes

There is a new util function loadCachedUndoBlocks. This avoids previous duplication with the (currently disabled) mutation-time fold cache, and moves this code closer to poseEditByTarget which is the "alternative" method for doing this kind of work (and maybe eventually we can improve unification between these codepaths). The main goal here is to at least avoid doing the extra "folding operation" in a random part of the code we'd be liable to forget about if we need to tweak dot plot pre-computation later. Bonus, this is also clearer.

Also I took this opportunity to finally clean up the execfoldCB thing in poseEditByTarget to remove the indirection which confuses me every time I look at it (we had to touch part of that code anyways).

Testing

Tested next/previous solution and simple mutations on OK round 6 puzzle with this constraint

Related Issues

Continues #791