Open huss opened 6 months ago
@huss and I tried this and could not reproduce this error. Should do a final check to verify that this no longer exists.
I tested this some more. If you wait at least several seconds after saving the unit after the rate change then it all works as desired. However, if you quickly go back to the line graphic page then OED crashes. In the console you see:
I have not debugged this but in the server console you see it is doing a DB refresh as it should when the unit rate changes. I would not be surprised if the issue might relate to the time it takes for that to happen (but am not sure). If so, this could be a more general issue. Does @ChrisMart21 have any ideas on this?
Have not looked too deeply into this, however some thoughts: Notice that uiSelectors.ts - -SelectUnitCompatibility
Calls methods from determinecompatibleunits.ts
SelectUnitCompatibility 'depends' on unit data, but it isn't in the dependency array for the selector. Which seems like it could be the issue when editing units
determineCompatibleUnits.ts is importing store directly to do the computations which is bypassing the dependency array for the selector, and this selector is subsequently relied on by many other selectors for UI and graphing etc.. so this would be my first guess.
As for the app crashing, unless you wait a few seconds seems more bizarre to me. Not sure why it may be crashing, however the behavior @huss is describing seems like RTKQuery cache invalidating due to time spent unsubscribed from the query. Given a 'few seconds ' + the time it takes to navigate to the admin page /modify units seems like it would hit that 60 second unsubscribe cache invalidating trigger. When navigating back to the graphic page it would then cause a re-fetch instead of using the cache. Not sure why this would be the case, but invalidating graphic data on update may be an easy fix?
Perhaps fixing the selector issue would be a fix all,but not sure. Definitely something to look into though.
Describe the bug
If you update the rate on a flow unit that is currently being graphed in a line unit does not update the values on the graph (or Redux state). A web page refresh does show the new values.
To Reproduce
Steps to reproduce the behavior:
Additional context
I looked at this a little:
Given this, I'm unsure why the Redux state does not update but did not look in detail.