Skip to content

Commit

Permalink
fix: refresh sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
jebibot committed Jan 25, 2024
1 parent d656df8 commit f005708
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions web/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ const refreshSidebar = async (sidebar) => {
if (config.updateSidebar) {
const sidebarEffect = await findReactState(
sidebar,
(state) => state.tag === 8 && state.destroy == null
(state) =>
state.tag === 8 && state.destroy == null && state.deps?.length > 2
);
sidebarEffect?.create?.();
}
Expand Down Expand Up @@ -822,7 +823,10 @@ const addResizeHandle = (container) => {
let x = 0;
let chatWidth = Number(window.localStorage.getItem("chatWidth"));
if (chatWidth > 0) {
document.documentElement.style.setProperty("--knife-chat-width", `${chatWidth}px`);
document.documentElement.style.setProperty(
"--knife-chat-width",
`${chatWidth}px`
);
}
const onMouseMove = (e) => {
chatWidth = Math.max(
Expand All @@ -838,7 +842,10 @@ const addResizeHandle = (container) => {
document.removeEventListener("mouseup", onMouseUp);
container.style.width = "";
if (chatWidth > 0) {
document.documentElement.style.setProperty("--knife-chat-width", `${chatWidth}px`);
document.documentElement.style.setProperty(
"--knife-chat-width",
`${chatWidth}px`
);
window.localStorage.setItem("chatWidth", chatWidth);
}
};
Expand Down

0 comments on commit f005708

Please sign in to comment.