@lobehub/chat 0.72.0 → 0.72.2
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.72.2](https://github.com/lobehub/lobe-chat/compare/v0.72.1...v0.72.2)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-09-09**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix mobile switch when session selected.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Fix mobile switch when session selected, closes [#167](https://github.com/lobehub/lobe-chat/issues/167) ([40d8a11](https://github.com/lobehub/lobe-chat/commit/40d8a11))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 0.72.1](https://github.com/lobehub/lobe-chat/compare/v0.72.0...v0.72.1)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2023-09-09**</sup>
|
|
33
|
+
|
|
34
|
+
#### 🐛 Bug Fixes
|
|
35
|
+
|
|
36
|
+
- **misc**: 修正异步水合造成的初始状态不稳定的问题.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's fixed
|
|
44
|
+
|
|
45
|
+
- **misc**: 修正异步水合造成的初始状态不稳定的问题 ([2208f8a](https://github.com/lobehub/lobe-chat/commit/2208f8a))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
## [Version 0.72.0](https://github.com/lobehub/lobe-chat/compare/v0.71.1...v0.72.0)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2023-09-09**</sup>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { useSessionStore } from '../store';
|
|
4
|
-
import {
|
|
4
|
+
import { useEffectAfterSessionHydrated } from './useEffectAfterHydrated';
|
|
5
5
|
|
|
6
6
|
export const useSessionHydrated = () => {
|
|
7
7
|
// 根据 sessions 是否有值来判断是否已经初始化
|
|
@@ -9,9 +9,9 @@ export const useSessionHydrated = () => {
|
|
|
9
9
|
|
|
10
10
|
const [isInit, setInit] = useState(hasInited);
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
useEffectAfterSessionHydrated(() => {
|
|
13
13
|
if (!isInit) setInit(true);
|
|
14
|
-
});
|
|
14
|
+
}, []);
|
|
15
15
|
|
|
16
16
|
return isInit;
|
|
17
17
|
};
|
|
@@ -161,10 +161,13 @@ export const createSessionSlice: StateCreator<
|
|
|
161
161
|
Router.push(SESSION_CHAT_URL(id, get().isMobile));
|
|
162
162
|
},
|
|
163
163
|
switchSession: (sessionId = INBOX_SESSION_ID) => {
|
|
164
|
-
|
|
164
|
+
const { isMobile } = get();
|
|
165
|
+
// mobile also should switch session due to chat mobile route is different
|
|
166
|
+
// fix https://github.com/lobehub/lobe-chat/issues/163
|
|
167
|
+
if (!isMobile && get().activeId === sessionId) return;
|
|
165
168
|
|
|
166
169
|
get().activeSession(sessionId);
|
|
167
170
|
|
|
168
|
-
Router.push(SESSION_CHAT_URL(sessionId,
|
|
171
|
+
Router.push(SESSION_CHAT_URL(sessionId, isMobile));
|
|
169
172
|
},
|
|
170
173
|
});
|