mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
Merge pull request #867 from JeffreyBytes/hotfix/streamtable-filter-bug
Fix streams requery to respect table filters
This commit is contained in:
commit
fec868ac30
2 changed files with 15 additions and 4 deletions
|
|
@ -715,6 +715,7 @@ export default class API {
|
|||
static async queryStreamsTable(params) {
|
||||
try {
|
||||
API.lastStreamQueryParams = params;
|
||||
useStreamsTableStore.getState().setLastQueryParams(params);
|
||||
|
||||
const response = await request(
|
||||
`${host}/api/channels/streams/?${params.toString()}`
|
||||
|
|
@ -729,21 +730,24 @@ export default class API {
|
|||
}
|
||||
|
||||
static async requeryStreams() {
|
||||
if (!API.lastStreamQueryParams) {
|
||||
const params =
|
||||
useStreamsTableStore.getState().lastQueryParams ||
|
||||
API.lastStreamQueryParams;
|
||||
if (!params) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
const [response, ids] = await Promise.all([
|
||||
request(
|
||||
`${host}/api/channels/streams/?${API.lastStreamQueryParams.toString()}`
|
||||
`${host}/api/channels/streams/?${params.toString()}`
|
||||
),
|
||||
API.getAllStreamIds(API.lastStreamQueryParams),
|
||||
API.getAllStreamIds(params),
|
||||
]);
|
||||
|
||||
useStreamsTableStore
|
||||
.getState()
|
||||
.queryStreams(response, API.lastStreamQueryParams);
|
||||
.queryStreams(response, params);
|
||||
useStreamsTableStore.getState().setAllQueryIds(ids);
|
||||
|
||||
return response;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ const useStreamsTableStore = create((set) => ({
|
|||
},
|
||||
selectedStreamIds: [],
|
||||
allQueryIds: [],
|
||||
lastQueryParams: null,
|
||||
|
||||
queryStreams: ({ results, count }, params) => {
|
||||
set(() => ({
|
||||
|
|
@ -44,6 +45,12 @@ const useStreamsTableStore = create((set) => ({
|
|||
sorting,
|
||||
}));
|
||||
},
|
||||
|
||||
setLastQueryParams: (lastQueryParams) => {
|
||||
set(() => ({
|
||||
lastQueryParams,
|
||||
}));
|
||||
},
|
||||
}));
|
||||
|
||||
export default useStreamsTableStore;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue