mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
[24.0] Fix hasOwner function for histories in client
The `hasOwner` function in `api/index.ts` was checking: ``` return "user_id" in history; ``` whereas, it also needed to check: ``` return "user_id" in history && history.user_id !== null; ``` because we assume histories (summaries) initally fetched for the `historyStore` without user_id are owned by the current user, but the key is still present in the backend return. This was causing a really troublesome bug in the `HistoryScrollList` found in the history selector modal, where we could constantly keep fetching `api/histories/count` since we didn't have the expected no. of histories loaded in the component; because `historiesProxy` (which only contains owned histories) would end up being empty.
This commit is contained in:
@@ -228,5 +228,5 @@ export function userOwnsHistory(user: User | AnonymousUser | null, history: AnyH
|
||||
}
|
||||
|
||||
function hasOwner(history: AnyHistory): history is HistorySummaryExtended {
|
||||
return "user_id" in history;
|
||||
return "user_id" in history && history.user_id !== null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user