Skip to content

Commit

Permalink
CVE revision: fast forward on old cookie, maintain mutation consisten…
Browse files Browse the repository at this point in the history
…cy by pulling all updates & deletes (#11)
  • Loading branch information
tantaman committed Dec 8, 2023
1 parent 3bb9399 commit cfefc45
Show file tree
Hide file tree
Showing 20 changed files with 4,292 additions and 1,117 deletions.
2 changes: 1 addition & 1 deletion client/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const App = ({rep, undoManager}: AppProps) => {
const ev = new EventSource(`/api/replicache/poke?channel=poke`);
ev.onmessage = async () => {
console.log('Receive poke. Pulling');
return rep.pull();
void rep.pull();
};
return () => ev.close();
}, []);
Expand Down
9 changes: 2 additions & 7 deletions client/src/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ export function reducer(
};
}
}

return state;
}

function diffReducer(state: State, diff: Diff): State {
Expand All @@ -150,11 +148,8 @@ function diffReducer(state: State, diff: Diff): State {
newViewIssueCount++;
}
if (state.filters.issuesFilter(newIssue)) {
newFilteredIssues.splice(
sortedIndexBy(newFilteredIssues, newIssue, orderIteratee),
0,
newIssue,
);
const idx = sortedIndexBy(newFilteredIssues, newIssue, orderIteratee);
newFilteredIssues.splice(idx, 0, newIssue);
}
}
function del(key: string, oldValue: ReadonlyJSONValue) {
Expand Down
8 changes: 3 additions & 5 deletions notes.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# TODO:

- multiple selections for filter infinite loop problem
- diff problem and duplicate id(s)

psql -d postgres -c 'create database repliear2'

- Deletion culling tagged to prior CVR?
- Viewed page sync?

- do check db for cvr so if we drop db we re-sync. rather than this cookie reconstitution
Loading

0 comments on commit cfefc45

Please sign in to comment.