diff --git a/frontend/app.tsx b/frontend/app.tsx index 7e2c46e..69804ab 100644 --- a/frontend/app.tsx +++ b/frontend/app.tsx @@ -1,43 +1,42 @@ -import React, { memo, useCallback, useEffect, useReducer } from "react"; +import type { UndoManager } from "@rocicorp/undo"; +import classnames from "classnames"; +import { generateKeyBetween } from "fractional-indexing"; +import { isEqual, minBy, partial, pickBy, sortBy, sortedIndexBy } from "lodash"; +import { useQueryState } from "next-usequerystate"; +import { memo, useCallback, useEffect, useReducer, useState } from "react"; +import { HotKeys } from "react-hotkeys"; import type { ExperimentalDiff as Diff, - ReadonlyJSONValue, ReadTransaction, + ReadonlyJSONValue, Replicache, } from "replicache"; -import LeftMenu from "./left-menu"; -import type { M } from "./mutators"; +import { useSubscribe } from "replicache-react"; +import { getPartialSyncState } from "./control"; import { - Issue, - issueFromKeyAndValue, + Comment, + Description, ISSUE_KEY_PREFIX, + Issue, + IssueUpdate, + IssueUpdateWithID, Order, - orderEnumSchema, Priority, - priorityEnumSchema, Status, - statusEnumSchema, - Description, - Comment, - IssueUpdate, + issueFromKeyAndValue, + orderEnumSchema, + priorityEnumSchema, + priorityOrderValues, reverseTimestampSortKey, + statusEnumSchema, statusOrderValues, - priorityOrderValues, - IssueUpdateWithID, } from "./issue"; -import { useState } from "react"; -import TopFilter from "./top-filter"; -import IssueList from "./issue-list"; -import { useQueryState } from "next-usequerystate"; import IssueBoard from "./issue-board"; -import { isEqual, minBy, partial, pickBy, sortBy, sortedIndexBy } from "lodash"; import IssueDetail from "./issue-detail"; -import { generateKeyBetween } from "fractional-indexing"; -import { useSubscribe } from "replicache-react"; -import classnames from "classnames"; -import { getPartialSyncState } from "./control"; -import type { UndoManager } from "@rocicorp/undo"; -import { HotKeys } from "react-hotkeys"; +import IssueList from "./issue-list"; +import LeftMenu from "./left-menu"; +import type { M } from "./mutators"; +import TopFilter from "./top-filter"; class Filters { private readonly _viewStatuses: Set | undefined; @@ -438,35 +437,22 @@ const App = ({ rep, undoManager }: AppProps) => { issueUpdate.issue, (_, key) => key in issueUpdate.issueChanges ); - const rv: IssueUpdateWithID = { + return { id: issueUpdate.issue.id, issueChanges: undoChanges, + descriptionChange: issueUpdate.descriptionUpdate?.description, }; - const { descriptionUpdate } = issueUpdate; - if (descriptionUpdate) { - return { - ...rv, - descriptionChange: descriptionUpdate.description, - }; - } - return rv; } ); await undoManager.add({ execute: () => rep.mutate.updateIssues( issueUpdates.map(({ issue, issueChanges, descriptionUpdate }) => { - const rv: IssueUpdateWithID = { + return { id: issue.id, issueChanges, + descriptionChange: descriptionUpdate?.description, }; - if (descriptionUpdate) { - return { - ...rv, - descriptionChange: descriptionUpdate.description, - }; - } - return rv; }) ), undo: () => rep.mutate.updateIssues(uChanges), diff --git a/frontend/issue.ts b/frontend/issue.ts index d71dc62..8692707 100644 --- a/frontend/issue.ts +++ b/frontend/issue.ts @@ -113,7 +113,7 @@ export type IssueUpdate = { export type IssueUpdateWithID = Immutable<{ id: string; issueChanges: Partial; - descriptionChange?: Description; + descriptionChange?: Description | undefined; }>; export async function getIssue( diff --git a/package-lock.json b/package-lock.json index e5cf077..1861887 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,7 @@ "react-remark": "^2.1.0", "react-virtualized-auto-sizer": "^1.0.6", "react-window": "^1.8.6", - "replicache": ">=14.0.3", + "replicache": "^14.1.0", "replicache-react": "5.0.1", "zod": "^3.13.4" }, @@ -8809,9 +8809,9 @@ } }, "node_modules/replicache": { - "version": "14.0.3", - "resolved": "https://registry.npmjs.org/replicache/-/replicache-14.0.3.tgz", - "integrity": "sha512-BXj8Wg2LS15h+3H66ws5XDHlNT88mLjqEkvxhecg4OaqnfNMBJRr5/gM9Chu4gVciH5w90G1X6JTsshgvW2FBg==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/replicache/-/replicache-14.1.0.tgz", + "integrity": "sha512-hFCnTBvFTw4j/cggSlzPkDpFkXnYGgSI18qYBTRtPR24m+J92dGvorGqh9+CFvzeSxF+VTf7zeAvF/MKqb3y+w==", "dependencies": { "@badrap/valita": "^0.3.0", "@rocicorp/lock": "^1.0.3", @@ -16052,9 +16052,9 @@ } }, "replicache": { - "version": "14.0.3", - "resolved": "https://registry.npmjs.org/replicache/-/replicache-14.0.3.tgz", - "integrity": "sha512-BXj8Wg2LS15h+3H66ws5XDHlNT88mLjqEkvxhecg4OaqnfNMBJRr5/gM9Chu4gVciH5w90G1X6JTsshgvW2FBg==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/replicache/-/replicache-14.1.0.tgz", + "integrity": "sha512-hFCnTBvFTw4j/cggSlzPkDpFkXnYGgSI18qYBTRtPR24m+J92dGvorGqh9+CFvzeSxF+VTf7zeAvF/MKqb3y+w==", "requires": { "@badrap/valita": "^0.3.0", "@rocicorp/lock": "^1.0.3", diff --git a/package.json b/package.json index 54ebec3..3a6988c 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "react-remark": "^2.1.0", "react-virtualized-auto-sizer": "^1.0.6", "react-window": "^1.8.6", - "replicache": ">=14.0.3", + "replicache": "^14.1.0", "replicache-react": "5.0.1", "zod": "^3.13.4" },