@planningcenter/chat-react-native 4.3.0-rc.2 → 4.3.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/__utils__/query_client.ts +3 -0
- package/src/hooks/__tests__/use_message_create_or_update.test.tsx +2 -7
- package/src/utils/cache/__tests__/messages_cache.test.ts +2 -1
- package/src/utils/cache/__tests__/messages_cache_deletion.test.ts +2 -1
- package/src/utils/cache/__tests__/messages_cache_reply_roots.test.ts +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "4.3.0-rc.
|
|
3
|
+
"version": "4.3.0-rc.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"sf-symbols-typescript": "^2.2.0",
|
|
85
85
|
"typescript": "~6.0.3"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "84299df37b2184567065ba635e7f3f68cf2d15b6"
|
|
88
88
|
}
|
|
@@ -7,13 +7,8 @@ import { getMessagesQueryKey } from '../../utils/request/get_messages'
|
|
|
7
7
|
import { useMessageCreateOrUpdate } from '../use_message_create_or_update'
|
|
8
8
|
|
|
9
9
|
jest.mock('../../contexts/api_provider', () => {
|
|
10
|
-
const {
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
chatQueryClient: new QueryClient({
|
|
14
|
-
defaultOptions: { queries: { gcTime: 0 }, mutations: { gcTime: 0 } },
|
|
15
|
-
}),
|
|
16
|
-
}
|
|
10
|
+
const { buildTestQueryClient } = require('../../__utils__/query_client')
|
|
11
|
+
return { chatQueryClient: buildTestQueryClient() }
|
|
17
12
|
})
|
|
18
13
|
|
|
19
14
|
const mockPost = jest.fn()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InfiniteData, QueryClient } from '@tanstack/react-query'
|
|
2
|
+
import { buildTestQueryClient } from '../../../__utils__/query_client'
|
|
2
3
|
import type { ApiCollection, MessageResource } from '../../../types'
|
|
3
4
|
import type { PersonResource } from '../../../types/resources/person'
|
|
4
5
|
import { updateCacheWithMessage } from '../messages_cache'
|
|
@@ -44,7 +45,7 @@ describe('updateCacheWithMessage on message.created', () => {
|
|
|
44
45
|
let queryClient: QueryClient
|
|
45
46
|
|
|
46
47
|
beforeEach(() => {
|
|
47
|
-
queryClient =
|
|
48
|
+
queryClient = buildTestQueryClient()
|
|
48
49
|
seed(
|
|
49
50
|
queryClient,
|
|
50
51
|
message({ id: '01B-temp', idempotentKey: 'key-b', pending: true }),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InfiniteData, QueryClient } from '@tanstack/react-query'
|
|
2
|
+
import { buildTestQueryClient } from '../../../__utils__/query_client'
|
|
2
3
|
import type { ApiCollection, ApiResource, MessageResource } from '../../../types'
|
|
3
4
|
import type { PersonResource } from '../../../types/resources/person'
|
|
4
5
|
import { getMessageQueryKey } from '../../request/get_message'
|
|
@@ -52,7 +53,7 @@ describe('applyMessageDeletionToCaches', () => {
|
|
|
52
53
|
const reply = message('reply', { replyRootId: 'root', replyRoot: root, text: 'Smith family' })
|
|
53
54
|
|
|
54
55
|
beforeEach(() => {
|
|
55
|
-
queryClient =
|
|
56
|
+
queryClient = buildTestQueryClient()
|
|
56
57
|
seedPages(queryClient, mainKey, [reply, message('other'), root])
|
|
57
58
|
seedPages(queryClient, threadKey, [reply, root])
|
|
58
59
|
queryClient.setQueryData<ApiResource<MessageResource>>(rootKey, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InfiniteData, QueryClient } from '@tanstack/react-query'
|
|
2
|
+
import { buildTestQueryClient } from '../../../__utils__/query_client'
|
|
2
3
|
import type { ApiCollection } from '../../../types'
|
|
3
4
|
import type { MessageResource } from '../../../types/resources/message'
|
|
4
5
|
import type { PersonResource } from '../../../types/resources/person'
|
|
@@ -39,7 +40,7 @@ const pageMessages = (queryClient: QueryClient) =>
|
|
|
39
40
|
|
|
40
41
|
describe('updateCacheReplyRoots', () => {
|
|
41
42
|
it('merges a root update into every reply carrying that root', () => {
|
|
42
|
-
const queryClient =
|
|
43
|
+
const queryClient = buildTestQueryClient()
|
|
43
44
|
const root = message('rootA', { replyRootId: 'rootA', text: 'before' })
|
|
44
45
|
seedPages(queryClient, [
|
|
45
46
|
message('03', { replyRootId: 'rootA', replyRoot: root }),
|
|
@@ -60,7 +61,7 @@ describe('updateCacheReplyRoots', () => {
|
|
|
60
61
|
})
|
|
61
62
|
|
|
62
63
|
it('ignores replies without an inline root', () => {
|
|
63
|
-
const queryClient =
|
|
64
|
+
const queryClient = buildTestQueryClient()
|
|
64
65
|
seedPages(queryClient, [message('01', { replyRootId: 'rootA' })])
|
|
65
66
|
|
|
66
67
|
updateCacheReplyRoots(queryClient, queryKey, message('rootA', { replyRootId: 'rootA' }))
|