Fix Sort Being Lost on osrc Refresh#124
Conversation
Greptile SummaryThis PR fixes a bug where the active sort order was lost when an
Confidence Score: 5/5Safe to merge — the change is a targeted 4-line addition that restores an omitted step in the refresh path. The fix mirrors exactly what osrc_action_order_object already does and slots into the existing pendingorderobject machinery without altering any other code path. The guard against an already-set pendingorderobject correctly handles concurrent sort changes. Both the QueryText and QueryObject refresh branches benefit from the fix because both consume pendingorderobject when building the SQL statement. No files require special attention.
|
| Filename | Overview |
|---|---|
| centrallix-os/sys/js/htdrv_osrc.js | Adds sort-preservation logic to osrc_action_refresh; the fix is minimal, correctly guarded, and consistent with how other query paths use pendingorderobject. |
Sequence Diagram
sequenceDiagram
participant User
participant osrc
participant QueryHandler
User->>osrc: OrderObject(sortCol)
osrc->>osrc: "pendingorderobject = sortCol"
osrc->>QueryHandler: QueryObject / QueryText
QueryHandler->>osrc: osrc_cb_query_continue_2()
osrc->>osrc: "orderobject = pendingorderobject (sortCol)"
osrc->>osrc: "pendingorderobject = null"
Note over User,osrc: Later — user triggers Refresh
User->>osrc: Refresh action
osrc->>osrc: "[NEW] if !pendingorderobject and orderobject pendingorderobject = orderobject"
osrc->>QueryHandler: QueryObject / QueryText (includes ORDER BY)
QueryHandler->>osrc: osrc_cb_query_continue_2()
osrc->>osrc: "orderobject = pendingorderobject (sortCol)"
osrc->>osrc: "pendingorderobject = null"
QueryHandler-->>User: Results returned with sort preserved
Reviews (1): Last reviewed commit: "Fix sort being lost when an osrc is refr..." | Re-trigger Greptile
|
This PR is ready for human review. |
Refreshing a sorted osrc causes the sort to be lost. This happened for me when I tested refreshing content in a table after the user had clicked a column to sort the content, and the Refresh action dropped the sort. This PR fixes that.