tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
27
pulls
pipelines
use fallback if replicache hasn't initialized yet
awarm.space
2 years ago
d78a2c61
73b3e836
+5
-2
2 changed files
expand all
collapse all
unified
split
replicache
index.tsx
pull.ts
+4
-2
replicache/index.tsx
···
126
126
);
127
127
let data = useSubscribe(
128
128
rep,
129
129
-
(tx) => {
129
129
+
async (tx) => {
130
130
+
let initialized = await tx.get("initialized");
131
131
+
if (!initialized) return null;
130
132
return tx
131
133
.scan<Fact<A>>({ indexName: "eav", prefix: `${entity}-${attribute}` })
132
134
.toArray();
···
136
138
dependencies: [entity, attribute],
137
139
},
138
140
);
139
139
-
let d = data || (attribute === "card/block" ? fallbackData : []);
141
141
+
let d = data || fallbackData;
140
142
return Attributes[attribute].cardinality === "many"
141
143
? (d as CardinalityResult<A>)
142
144
: (d[0] as CardinalityResult<A>);
+1
replicache/pull.ts
···
33
33
lastMutationIDChanges: clientGroup,
34
34
patch: [
35
35
{ op: "clear" },
36
36
+
{ op: "put", key: "initialized", value: true },
36
37
...facts.map((f) => {
37
38
return {
38
39
op: "put",