Skip to content

Commit 3fbee52

Browse files
authored
CVE revision: fast forward on old cookie, maintain mutation consistency by pulling all updates & deletes (#11)
1 parent 3bb9399 commit 3fbee52

19 files changed

+4293
-1118
lines changed

client/src/app.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const App = ({rep, undoManager}: AppProps) => {
6767
const ev = new EventSource(`/api/replicache/poke?channel=poke`);
6868
ev.onmessage = async () => {
6969
console.log('Receive poke. Pulling');
70-
return rep.pull();
70+
void rep.pull();
7171
};
7272
return () => ev.close();
7373
}, []);

client/src/reducer.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ export function reducer(
130130
};
131131
}
132132
}
133-
134-
return state;
135133
}
136134

137135
function diffReducer(state: State, diff: Diff): State {
@@ -150,11 +148,8 @@ function diffReducer(state: State, diff: Diff): State {
150148
newViewIssueCount++;
151149
}
152150
if (state.filters.issuesFilter(newIssue)) {
153-
newFilteredIssues.splice(
154-
sortedIndexBy(newFilteredIssues, newIssue, orderIteratee),
155-
0,
156-
newIssue,
157-
);
151+
const idx = sortedIndexBy(newFilteredIssues, newIssue, orderIteratee);
152+
newFilteredIssues.splice(idx, 0, newIssue);
158153
}
159154
}
160155
function del(key: string, oldValue: ReadonlyJSONValue) {

notes.md

-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
2-
31
psql -d postgres -c 'create database repliear2'
4-
5-
- Deletion culling tagged to prior CVR?
6-
- Viewed page sync?
7-
8-
- do check db for cvr so if we drop db we re-sync. rather than this cookie reconstitution

0 commit comments

Comments
 (0)