Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed date-fns imports #125

Merged
merged 7 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .changeset/loud-brooms-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
"@xmtp/react-sdk": major
rygine marked this conversation as resolved.
Show resolved Hide resolved
---

### Fixed imports of `date-fns` package for Next.js compatibility

- **Issue**: [Fix of reported bug #124](https://github.com/xmtp/xmtp-web/issues/124)
- **Changes**:
- Changed imports from:
```javascript
import xxx from "date-fns/xxx";
```
to:
```javascript
import { xxx } from "date-fns";
```
- **Affected Files**:
- `packages/react-sdk/src/helpers/caching/contentTypes/readReceipt.test.ts`
- `packages/react-sdk/src/helpers/caching/contentTypes/readReceipt.ts`
- `packages/react-sdk/src/hooks/useMessages.ts`
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ContentTypeReadReceipt,
ReadReceiptCodec,
} from "@xmtp/content-type-read-receipt";
import subSeconds from "date-fns/subSeconds";
import { subSeconds } from "date-fns";
import { type CachedMessageWithId } from "@/helpers/caching/messages";
import { getDbInstance, clearCache } from "@/helpers/caching/db";
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import {
ContentTypeReadReceipt,
} from "@xmtp/content-type-read-receipt";
import { ContentTypeId } from "@xmtp/xmtp-js";
import { parseISO } from "date-fns";
import { z } from "zod";
import isAfter from "date-fns/isAfter";
import { isAfter, parseISO } from "date-fns";
import type {
ContentTypeConfiguration,
ContentTypeMessageProcessor,
Expand Down
3 changes: 1 addition & 2 deletions packages/react-sdk/src/hooks/useMessages.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SortDirection, type DecodedMessage } from "@xmtp/xmtp-js";
import { useCallback, useEffect, useRef, useState } from "react";
import min from "date-fns/min";
import subSeconds from "date-fns/subSeconds";
import { min, subSeconds } from "date-fns";
import type { OnError } from "../sharedTypes";
import { useCachedMessages } from "./useCachedMessages";
import type { CachedMessageWithId } from "@/helpers/caching/messages";
Expand Down