a tool for shared writing and social publishing

delete facts in write cache if delete entity

+5 -10
+5 -10
src/replicache/cachedServerMutationContext.ts
··· 124 124 if (!(await this.checkPermission(entity))) return; 125 125 deleteEntitiesCache.push(entity); 126 126 entitiesCache = entitiesCache.filter((e) => e.id !== entity); 127 + writeCache = writeCache.filter( 128 + (f) => 129 + f.type !== "put" || 130 + (f.fact.entity !== entity && f.fact.data.value !== entity), 131 + ); 127 132 }, 128 133 async assertFact(f) { 129 134 if (!f.entity) return; ··· 136 141 let existingFact = await scanIndex.eav(f.entity, f.attribute); 137 142 if (existingFact[0]) { 138 143 id = existingFact[0].id; 139 - if (attribute.type === "text") { 140 - let c = 141 - textAttributeWriteCache[`${f.entity}-${f.attribute}`] || {}; 142 - textAttributeWriteCache[`${f.entity}-${f.attribute}`] = { 143 - ...c, 144 - [clientID]: ( 145 - data as Fact<keyof FilterAttributes<{ type: "text" }>>["data"] 146 - ).value, 147 - }; 148 - } 149 144 } 150 145 } 151 146 writeCache = writeCache.filter((f) => f.fact.id !== id);