mirror of
https://github.com/danog/telegram-tt.git
synced 2025-01-22 13:21:37 +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();
|
||||
|
||||
addActionHandler('init', (global) => {
|
||||
addActionHandler('init', () => {
|
||||
const initial = cloneDeep(INITIAL_STATE);
|
||||
return {
|
||||
...global,
|
||||
...(loadCache(initial) || initial),
|
||||
};
|
||||
return loadCache(initial) || initial;
|
||||
});
|
||||
|
@ -71,7 +71,7 @@ function runCallbacks(forceOnHeavyAnimation = false) {
|
||||
export function setGlobal(newGlobal?: GlobalState, options?: ActionOptions) {
|
||||
if (typeof newGlobal === 'object' && newGlobal !== currentGlobal) {
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user