mirror of
https://github.com/SableClient/Sable.git
synced 2026-12-04 07:42:24 -08:00
Small performance and visual tweaks (#1180)
<!-- Please read https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before submitting your pull request --> ### Description <!-- Please include a summary of the change. Please also include relevant motivation and context. List any dependencies that are required for this change. --> Actually small this time. #### Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings ### AI disclosure: - [ ] Partially AI assisted (clarify which code was AI assisted and briefly explain what it does). - [ ] Fully AI generated (explain what all the generated code does in moderate detail). <!-- Write any explanation required here, but do not generate the explanation using AI!! You must prove you understand what the code in this PR does. -->
This commit is contained in:
11 files changed
+64
-30
No files matched your search
Generated
+16
-16
@@ -148,7 +148,7 @@ version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -159,7 +159,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"once_cell_polyfill",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1481,7 +1481,7 @@ dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1783,7 +1783,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3548,7 +3548,7 @@ dependencies = [
|
||||
"png 0.18.1",
|
||||
"serde",
|
||||
"thiserror 2.0.18",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3672,7 +3672,7 @@ version = "0.50.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4068,7 +4068,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5155,7 +5155,7 @@ dependencies = [
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5213,7 +5213,7 @@ dependencies = [
|
||||
"security-framework",
|
||||
"security-framework-sys",
|
||||
"webpki-root-certs",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5795,7 +5795,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6346,9 +6346,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-devtools"
|
||||
version = "2.1.0"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a8fa7b8275c5f3efed02591d5c080540bec4c3e5b3180586fcd824953328e8e"
|
||||
checksum = "8e5cd17faa36a826e5686bd0fda5bc3f4c903682263f00cd50f2f778fc4bb866"
|
||||
dependencies = [
|
||||
"async-stream",
|
||||
"bytes",
|
||||
@@ -6842,7 +6842,7 @@ dependencies = [
|
||||
"getrandom 0.4.2",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7468,7 +7468,7 @@ dependencies = [
|
||||
"png 0.18.1",
|
||||
"serde",
|
||||
"thiserror 2.0.18",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7542,7 +7542,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"
|
||||
dependencies = [
|
||||
"memoffset",
|
||||
"tempfile",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -8212,7 +8212,7 @@ version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -56,7 +56,9 @@ tauri-plugin-clipboard-manager = "2.3.2"
|
||||
# `tauri/wry`); Sable's own `wry` feature already enables `tauri/wry` for wry
|
||||
# builds, and CEF builds (--no-default-features --features cef) must not pull
|
||||
# wry/tauri-runtime-wry/webkit2gtk.
|
||||
tauri-plugin-devtools = { version = "2.0.0", default-features = false }
|
||||
# Pinned to =2.0.0 because 2.1.0+ introduced an unconditional call to
|
||||
# tauri::webview_version() which is gated behind tauri's `wry` feature.
|
||||
tauri-plugin-devtools = { version = "=2.0.0", default-features = false }
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
enigo = "0.5.0"
|
||||
|
||||
@@ -2,7 +2,7 @@ use tauri::AppHandle;
|
||||
use tauri_plugin_dialog::DialogExt;
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn save_download(
|
||||
pub fn save_download(
|
||||
app: AppHandle<crate::BrowserEngine>,
|
||||
filename: String,
|
||||
bytes: Vec<u8>,
|
||||
|
||||
@@ -188,11 +188,15 @@ async fn run_upload(
|
||||
let progress_stream = async_stream::stream! {
|
||||
let mut reader = FramedRead::new(file, BytesCodec::new());
|
||||
let mut loaded: u64 = 0;
|
||||
let mut last_emitted_loaded: u64 = 0;
|
||||
while let Some(item) = reader.next().await {
|
||||
match item {
|
||||
Ok(chunk) => {
|
||||
loaded += chunk.len() as u64;
|
||||
let _ = on_progress.send(ProgressPayload { loaded, total });
|
||||
if loaded - last_emitted_loaded >= 256 * 1024 || loaded == total {
|
||||
let _ = on_progress.send(ProgressPayload { loaded, total });
|
||||
last_emitted_loaded = loaded;
|
||||
}
|
||||
yield Ok::<_, std::io::Error>(chunk.freeze());
|
||||
}
|
||||
Err(err) => yield Err(err),
|
||||
|
||||
@@ -114,12 +114,21 @@ export function PollEvent({ content, mEvent, mx, room }: PollEventProps) {
|
||||
const [updateCounter, setUpdateCounter] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
const handleUpdate = () => setUpdateCounter((c) => c + 1);
|
||||
const handleUpdate = (event: MatrixEvent) => {
|
||||
const relation = event.getRelation();
|
||||
if (
|
||||
relation?.event_id === eventId ||
|
||||
event.getAssociatedId() === eventId ||
|
||||
event.getId() === eventId
|
||||
) {
|
||||
setUpdateCounter((c) => c + 1);
|
||||
}
|
||||
};
|
||||
room.on(RoomEvent.Timeline, handleUpdate);
|
||||
return () => {
|
||||
room.off(RoomEvent.Timeline, handleUpdate);
|
||||
};
|
||||
}, [room]);
|
||||
}, [room, eventId]);
|
||||
|
||||
// ensure a new sorted array is only generated when a new list is made
|
||||
useEffect(() => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { keyframes, style } from '@vanilla-extract/css';
|
||||
import { DefaultReset, color, config } from 'folds';
|
||||
import { DefaultReset, color, config, toRem } from 'folds';
|
||||
|
||||
const SlideUpAnime = keyframes({
|
||||
from: {
|
||||
@@ -13,12 +13,14 @@ const SlideUpAnime = keyframes({
|
||||
export const RoomViewTyping = style([
|
||||
DefaultReset,
|
||||
{
|
||||
padding: `0 ${config.space.S500}`,
|
||||
width: '100%',
|
||||
padding: `0 ${config.space.S200} 0 ${config.space.S500}`,
|
||||
backgroundColor: color.Surface.Container,
|
||||
color: color.Surface.OnContainer,
|
||||
position: 'absolute',
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: toRem(16),
|
||||
zIndex: 2,
|
||||
animation: `${SlideUpAnime} 100ms ease-in-out`,
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Auto-generated TypeScript bindings for Tauri commands
|
||||
* Generated by tauri-typegen v0.5.0
|
||||
* Generated at: 2026-07-20T21:37:33.151522+00:00
|
||||
* Generated at: 2026-07-21T17:18:34.365576100+00:00
|
||||
* Generator: none
|
||||
*
|
||||
* Do not edit manually - regenerate using: cargo tauri-typegen generate
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Auto-generated TypeScript bindings for Tauri commands
|
||||
* Generated by tauri-typegen v0.5.0
|
||||
* Generated at: 2026-07-20T21:37:33.152063+00:00
|
||||
* Generated at: 2026-07-21T17:18:34.366699600+00:00
|
||||
* Generator: none
|
||||
*
|
||||
* Do not edit manually - regenerate using: cargo tauri-typegen generate
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Auto-generated TypeScript bindings for Tauri commands
|
||||
* Generated by tauri-typegen v0.5.0
|
||||
* Generated at: 2026-07-20T21:37:33.152232+00:00
|
||||
* Generated at: 2026-07-21T17:18:34.367242500+00:00
|
||||
* Generator: none
|
||||
*
|
||||
* Do not edit manually - regenerate using: cargo tauri-typegen generate
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Auto-generated TypeScript bindings for Tauri commands
|
||||
* Generated by tauri-typegen v0.5.0
|
||||
* Generated at: 2026-07-20T21:37:33.150377+00:00
|
||||
* Generated at: 2026-07-21T17:18:34.362712900+00:00
|
||||
* Generator: none
|
||||
*
|
||||
* Do not edit manually - regenerate using: cargo tauri-typegen generate
|
||||
@@ -144,3 +144,4 @@ export interface UploadWriteChunkParams {
|
||||
chunk: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
@@ -29,9 +29,25 @@ export const resolveHiddenEventSettings = (settings: Settings): ResolvedHiddenEv
|
||||
};
|
||||
};
|
||||
|
||||
export const isResolvedHiddenEventSettingsEqual = (
|
||||
a: ResolvedHiddenEventSettings,
|
||||
b: ResolvedHiddenEventSettings
|
||||
): boolean =>
|
||||
a.showHiddenEvents === b.showHiddenEvents &&
|
||||
a.showTombstoneEvents === b.showTombstoneEvents &&
|
||||
a.hiddenEventEdits === b.hiddenEventEdits &&
|
||||
a.hiddenEventRedactionTimeline === b.hiddenEventRedactionTimeline &&
|
||||
a.hiddenEventReactions === b.hiddenEventReactions &&
|
||||
a.hiddenEventReactionTombstone === b.hiddenEventReactionTombstone &&
|
||||
a.hiddenEventReactionRedactionTimeline === b.hiddenEventReactionRedactionTimeline &&
|
||||
a.hiddenEventOther === b.hiddenEventOther;
|
||||
|
||||
export const useHiddenEventSettings = (settingsAtom: typeof sAtom): ResolvedHiddenEventSettings => {
|
||||
const selector = useMemo(() => resolveHiddenEventSettings, []);
|
||||
return useAtomValue(selectAtom(settingsAtom, selector));
|
||||
const hiddenSettingsAtom = useMemo(
|
||||
() => selectAtom(settingsAtom, resolveHiddenEventSettings, isResolvedHiddenEventSettingsEqual),
|
||||
[settingsAtom]
|
||||
);
|
||||
return useAtomValue(hiddenSettingsAtom);
|
||||
};
|
||||
|
||||
export type SettingSetter<K extends keyof Settings> =
|
||||
|
||||
Reference in new issue
Block a user