Merge branch 'fix-pizzax-2' into pizzax-indexeddb
This commit is contained in:
		
						commit
						2a1258e5d9
					
				
					 1 changed files with 6 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -100,16 +100,16 @@ export class Storage<T extends StateDef> {
 | 
			
		|||
				}, 1);
 | 
			
		||||
 | 
			
		||||
				// streamingのuser storage updateイベントを監視して更新
 | 
			
		||||
				connection?.on('registryUpdated', async ({ scope, key, value }: { scope: string[], key: keyof T, value: T[typeof key]['default'] }) => {
 | 
			
		||||
					if (scope[1] !== this.key || this.state[key] === value) return;
 | 
			
		||||
	
 | 
			
		||||
				connection?.on('registryUpdated', ({ scope, key, value }: { scope: string[], key: keyof T, value: T[typeof key]['default'] }) => {
 | 
			
		||||
					if (scope.length !== 2 || scope[0] !== 'client' || scope[1] !== this.key || this.state[key] === value) return;
 | 
			
		||||
 | 
			
		||||
					this.state[key] = value;
 | 
			
		||||
					this.reactiveState[key].value = value;
 | 
			
		||||
	
 | 
			
		||||
					const cache = await get(this.registryCacheKeyName);
 | 
			
		||||
 | 
			
		||||
					const cache = JSON.parse(localStorage.getItem(this.keyForLocalStorage + '::cache::' + $i.id) || '{}');
 | 
			
		||||
					if (cache[key] !== value) {
 | 
			
		||||
						cache[key] = value;
 | 
			
		||||
						await set(this.registryCacheKeyName, cache);
 | 
			
		||||
						localStorage.setItem(this.keyForLocalStorage + '::cache::' + $i.id, JSON.stringify(cache));
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue