Skip to content

Commit

Permalink
Response to code review: #3
Browse files Browse the repository at this point in the history
  • Loading branch information
aboodman committed Mar 2, 2021
1 parent 1b38c44 commit dc8a01c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/rds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export async function transact(body: TransactionBodyFn) {
export async function ensureDatabase() {
const result = await executeStatementInDatabase(null, "SHOW DATABASES");
if (result.records) {
if (result.records.find((record) => record[0].stringValue == dbName)) {
if (result.records.find((record) => record[0].stringValue === dbName)) {
// TODO: Maybe migrate version
return;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/designer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function Designer({ data }: { data: Data }) {
};

const onMouseMove = (e: MouseEvent) => {
if (lastDrag == null) {
if (lastDrag === null) {
return;
}
// This is subtle, and worth drawing attention to:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/replicache-pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {
console.log(`Processing pull`, req.body);

const pull = must(pullRequest.decode(req.body));
let cookie = pull.baseStateID == "" ? 0 : parseInt(pull.baseStateID);
let cookie = pull.baseStateID === "" ? 0 : parseInt(pull.baseStateID);

console.time(`Reading all objects...`);
let entries;
Expand Down
5 changes: 3 additions & 2 deletions pages/api/replicache-push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {
console.log({ lastMutationID });

// Scan forward from here collapsing any collapsable mutations.
for (let mutation: Mutation; (mutation = push.mutations[i]); i++) {
for (; i < push.mutations.length; i++) {
let mutation = push.mutations[i];
console.log({ mutation });

const expectedMutationID = lastMutationID + 1;
Expand Down Expand Up @@ -119,7 +120,7 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {

// If prev and next are collapsible, collapse them by mutating next.
function collapse(prev: Mutation, next: Mutation): boolean {
if (prev.name == "moveShape" && next.name == "moveShape") {
if (prev.name === "moveShape" && next.name === "moveShape") {
next.args.dx += prev.args.dx;
next.args.dy += prev.args.dy;
return true;
Expand Down

0 comments on commit dc8a01c

Please sign in to comment.