mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-25 19:14:00 +00:00
update all row IDs in the store so stream table changes reflect in channel table
This commit is contained in:
parent
8625f2e524
commit
c5f7b183f1
3 changed files with 16 additions and 4 deletions
|
|
@ -192,13 +192,17 @@ export default class API {
|
|||
|
||||
static async requeryChannels() {
|
||||
try {
|
||||
const response = await request(
|
||||
`${host}/api/channels/channels/?${API.lastQueryParams.toString()}`
|
||||
);
|
||||
const [response, ids] = await Promise.all([
|
||||
request(
|
||||
`${host}/api/channels/channels/?${API.lastQueryParams.toString()}`
|
||||
),
|
||||
API.getAllChannelIds(API.lastQueryParams),
|
||||
]);
|
||||
|
||||
useChannelsTableStore
|
||||
.getState()
|
||||
.queryChannels(response, API.lastQueryParams);
|
||||
useChannelsTableStore.getState().setAllQueryIds(ids);
|
||||
|
||||
return response;
|
||||
} catch (e) {
|
||||
|
|
|
|||
|
|
@ -199,6 +199,8 @@ const ChannelsTable = ({}) => {
|
|||
const setSorting = useChannelsTableStore((s) => s.setSorting);
|
||||
const totalCount = useChannelsTableStore((s) => s.totalCount);
|
||||
const setChannelStreams = useChannelsTableStore((s) => s.setChannelStreams);
|
||||
const allRowIds = useChannelsTableStore((s) => s.allQueryIds);
|
||||
const setAllRowIds = useChannelsTableStore((s) => s.setAllQueryIds);
|
||||
|
||||
// store/channels
|
||||
const channels = useChannelsStore((s) => s.channels);
|
||||
|
|
@ -228,7 +230,6 @@ const ChannelsTable = ({}) => {
|
|||
/**
|
||||
* useState
|
||||
*/
|
||||
const [allRowIds, setAllRowIds] = useState([]);
|
||||
const [channel, setChannel] = useState(null);
|
||||
const [channelModalOpen, setChannelModalOpen] = useState(false);
|
||||
const [recordingModalOpen, setRecordingModalOpen] = useState(false);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ const useChannelsTableStore = create((set, get) => ({
|
|||
pageSize: 50,
|
||||
},
|
||||
selectedChannelIds: [],
|
||||
allQueryIds: [],
|
||||
|
||||
queryChannels: ({ results, count }, params) => {
|
||||
set((state) => {
|
||||
|
|
@ -24,6 +25,12 @@ const useChannelsTableStore = create((set, get) => ({
|
|||
});
|
||||
},
|
||||
|
||||
setAllQueryIds: (allQueryIds) => {
|
||||
set((state) => ({
|
||||
allQueryIds,
|
||||
}));
|
||||
},
|
||||
|
||||
setSelectedChannelIds: (selectedChannelIds) => {
|
||||
set({
|
||||
selectedChannelIds,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue