mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-20 14:39:06 +00:00
chore: upgrade deps (#698)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { RuntimeStore } from 'ontime-types';
|
||||
|
||||
import { deepCompare, useRuntimeStore } from '../stores/runtime';
|
||||
import { useRuntimeStore } from '../stores/runtime';
|
||||
import { socketSendJson } from '../utils/socket';
|
||||
|
||||
export const useRundownEditor = () => {
|
||||
@@ -10,7 +10,7 @@ export const useRundownEditor = () => {
|
||||
nextEventId: state.loaded.nextEventId,
|
||||
});
|
||||
|
||||
return useRuntimeStore(featureSelector, deepCompare);
|
||||
return useRuntimeStore(featureSelector);
|
||||
};
|
||||
|
||||
export const useOperator = () => {
|
||||
@@ -19,7 +19,7 @@ export const useOperator = () => {
|
||||
selectedEventId: state.loaded.selectedEventId,
|
||||
});
|
||||
|
||||
return useRuntimeStore(featureSelector, deepCompare);
|
||||
return useRuntimeStore(featureSelector);
|
||||
};
|
||||
|
||||
export const useMessageControl = () => {
|
||||
@@ -31,7 +31,7 @@ export const useMessageControl = () => {
|
||||
onAir: state.onAir,
|
||||
});
|
||||
|
||||
return useRuntimeStore(featureSelector, deepCompare);
|
||||
return useRuntimeStore(featureSelector);
|
||||
};
|
||||
|
||||
export const setMessage = {
|
||||
@@ -55,7 +55,7 @@ export const usePlaybackControl = () => {
|
||||
numEvents: state.loaded.numEvents,
|
||||
});
|
||||
|
||||
return useRuntimeStore(featureSelector, deepCompare);
|
||||
return useRuntimeStore(featureSelector);
|
||||
};
|
||||
|
||||
export const setPlayback = {
|
||||
@@ -89,7 +89,7 @@ export const useInfoPanel = () => {
|
||||
numEvents: state.loaded.numEvents,
|
||||
});
|
||||
|
||||
return useRuntimeStore(featureSelector, deepCompare);
|
||||
return useRuntimeStore(featureSelector);
|
||||
};
|
||||
|
||||
export const useCuesheet = () => {
|
||||
@@ -101,7 +101,7 @@ export const useCuesheet = () => {
|
||||
titleNow: state.eventNow?.title || '',
|
||||
});
|
||||
|
||||
return useRuntimeStore(featureSelector, deepCompare);
|
||||
return useRuntimeStore(featureSelector);
|
||||
};
|
||||
|
||||
export const setEventPlayback = {
|
||||
@@ -116,7 +116,7 @@ export const useTimer = () => {
|
||||
...state.timer,
|
||||
});
|
||||
|
||||
return useRuntimeStore(featureSelector, deepCompare);
|
||||
return useRuntimeStore(featureSelector);
|
||||
};
|
||||
|
||||
export const setClientName = (newName: string) => socketSendJson('set-client-name', newName);
|
||||
@@ -129,5 +129,5 @@ export const useRuntimeOverview = () => {
|
||||
selectedEventIndex: state.loaded.selectedEventIndex,
|
||||
});
|
||||
|
||||
return useRuntimeStore(featureSelector, deepCompare);
|
||||
return useRuntimeStore(featureSelector);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import isEqual from 'react-fast-compare';
|
||||
import { Playback, RuntimeStore } from 'ontime-types';
|
||||
import { useStore } from 'zustand';
|
||||
import { createStore } from 'zustand/vanilla';
|
||||
import { createWithEqualityFn, useStoreWithEqualityFn } from 'zustand/traditional'
|
||||
|
||||
export const runtimeStorePlaceholder: RuntimeStore = {
|
||||
timer: {
|
||||
@@ -54,13 +53,13 @@ export const runtimeStorePlaceholder: RuntimeStore = {
|
||||
publicEventNext: null,
|
||||
};
|
||||
|
||||
export const runtime = createStore<RuntimeStore>(() => ({
|
||||
...runtimeStorePlaceholder,
|
||||
}));
|
||||
const deepCompare = <T>(a: T, b: T) => isEqual(a, b);
|
||||
|
||||
export const runtime = createWithEqualityFn<RuntimeStore>(() => ({
|
||||
...runtimeStorePlaceholder,
|
||||
}), deepCompare);
|
||||
|
||||
export const deepCompare = <T>(a: T, b: T) => isEqual(a, b);
|
||||
|
||||
export const useRuntimeStore = <T>(
|
||||
selector: (state: RuntimeStore) => T,
|
||||
equalityFn?: (a: unknown, b: unknown) => boolean,
|
||||
) => useStore(runtime, selector, equalityFn);
|
||||
) => useStoreWithEqualityFn(runtime, selector, deepCompare);
|
||||
|
||||
Reference in New Issue
Block a user