mirror of
https://github.com/danog/telegram-tt.git
synced 2025-01-22 21:31:22 +01:00
[Dev] TeactN: Assert when setting global asynchronously (follow-up)
This commit is contained in:
parent
91c2015052
commit
7d09556e4c
@ -6,10 +6,7 @@ import { cloneDeep } from '../util/iteratees';
|
|||||||
|
|
||||||
initCache();
|
initCache();
|
||||||
|
|
||||||
addActionHandler('init', (global) => {
|
addActionHandler('init', () => {
|
||||||
const initial = cloneDeep(INITIAL_STATE);
|
const initial = cloneDeep(INITIAL_STATE);
|
||||||
return {
|
return loadCache(initial) || initial;
|
||||||
...global,
|
|
||||||
...(loadCache(initial) || initial),
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
@ -71,7 +71,7 @@ function runCallbacks(forceOnHeavyAnimation = false) {
|
|||||||
export function setGlobal(newGlobal?: GlobalState, options?: ActionOptions) {
|
export function setGlobal(newGlobal?: GlobalState, options?: ActionOptions) {
|
||||||
if (typeof newGlobal === 'object' && newGlobal !== currentGlobal) {
|
if (typeof newGlobal === 'object' && newGlobal !== currentGlobal) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
if (newGlobal.DEBUG_id !== DEBUG_currentGlobalId) {
|
if (newGlobal.DEBUG_id && newGlobal.DEBUG_id !== DEBUG_currentGlobalId) {
|
||||||
throw new Error('[TeactN.setGlobal] Attempt to set an outdated global');
|
throw new Error('[TeactN.setGlobal] Attempt to set an outdated global');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user