audreyt / ethercalc

Node.js port of Multi-user SocialCalc
https://ethercalc.net
Other
2.96k stars 537 forks source link

fill down propagates, then changes later #769

Open pistachoo opened 2 years ago

pistachoo commented 2 years ago

Not sure how this happens, because it happens when I am not looking. Ie, when I go to a different app and come back to Chrome some time later... I filled the first two cells with 70, 67, then dragged to populate down to 31. Then typed =sum(F2:F15) to get the correct sum. But, a little while later, the cells had all changed to 70, and the sum had as well. Undo button does nothing. See screenshots.

Screen Shot 2021-11-02 at 5 25 24 PM ... Screen Shot 2021-11-02 at 5 25 57 PM ... Screen Shot 2021-11-02 at 5 26 02 PM

eddyparkinson commented 2 years ago

Thanks for reporting. I have also seen this problem and did not know the cause. But now I think I know why. I expect it is a difference between the client and server code. You see all commands are executed on both the client and the server. They should be the same and always be in sync. But looks like the drag might have a bug that causes the two to be different.

@audreyt do you know about the drag feature. Maybe you added it?

audreyt commented 2 years ago

It's part of the original SocialCalc filldown / fillright command set which behaves differently if two or more cells are selected:

https://github.com/marcelklehr/socialcalc/blob/master/js/socialcalc-3.js#L2186-L2193

To fix this, we need to encode the increment_amount into an extra argument to filldown / fillright. It may require changing the socialcalc layer? It's also possible to save and temporarily set the selection range2 here:

https://github.com/audreyt/ethercalc/blob/master/src/sc.ls#L136-L143

but I think encoding increment_amount is more neat. I wouldn't have cycles to work on it in the short term, but contributions are very much welcome.

GallusMax commented 1 month ago

Another "me too": Cells changed by "Fill constant down" will regularly pop back to their values even when leaving the sheet. Even "restart app" in the top bar resets the values to the old ones. THIS IS UGLY - (and renders the app unuseable!)