This commit is contained in:
2026-07-28 16:22:19 +07:00
parent 4253a6df3e
commit 0ae38d38d4
5 changed files with 26 additions and 29 deletions

View File

@@ -130,6 +130,7 @@ impl NostrRegistry {
// Connect to bootstrap relays after the window is ready
cx.defer_in(window, |this, _window, cx| {
this.connect_bootstrap_relays(cx);
#[cfg(not(target_arch = "wasm32"))]
this.get_user_credential(cx);
});

View File

@@ -214,6 +214,8 @@ impl Dock {
pub fn set_open(&mut self, open: bool, window: &mut Window, cx: &mut Context<Self>) {
self.open = open;
let item = self.panel.clone();
// Use defer_in (not window.defer) so the callback is cancelled
// if this Dock entity is dropped before the deferred frame runs.
cx.defer_in(window, move |_, window, cx| {
item.set_collapsed(!open, window, cx);
});

View File

@@ -55,7 +55,7 @@ impl Screening {
window.close_all_modals(cx);
}));
cx.defer_in(window, move |this, _window, cx| {
cx.defer_in(window, |this, _window, cx| {
this.check_contact(cx);
this.check_wot(cx);
this.check_last_activity(cx);

View File

@@ -62,7 +62,6 @@ fn main() {
// Open a window with default options
cx.open_window(opts, |window, cx| {
cx.new(|cx| {
// Initialize components
ui::init(cx);
@@ -89,9 +88,8 @@ fn main() {
// Initialize auto update
auto_update::init(window, cx);
// Root Entity
Root::new(workspace::init(window, cx).into(), window, cx)
})
// Root view
cx.new(|cx| Root::new(workspace::init(window, cx).into(), window, cx))
})
.expect("Failed to open window. Please restart the application.");

View File

@@ -39,8 +39,8 @@ fi
echo -e "${GREEN}Step 1: Building WASM...${NC}"
cd "$PROJECT_ROOT"
export CARGO_TARGET_DIR="$PROJECT_ROOT/target"
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory -C link-arg=--shared-memory -C link-arg=--max-memory=4294967296 -C link-arg=--import-memory -C link-arg=--export=__heap_base -C link-arg=--export=__wasm_init_tls -C link-arg=--export=__tls_size -C link-arg=--export=__tls_align -C link-arg=--export=__tls_base' \
cargo build --target wasm32-unknown-unknown $RELEASE_FLAG
RUSTFLAGS='-C target-feature=+bulk-memory -C link-arg=--max-memory=4294967296' \
cargo build --target wasm32-unknown-unknown $RELEASE_FLAG
# Determine the build directory
if [[ "$RELEASE_FLAG" == "--release" ]]; then
@@ -58,10 +58,6 @@ if [[ ! -f "$WASM_PATH" ]]; then
exit 1
fi
# Step 1.5: Force shared memory (linker --shared-memory is not working)
echo -e "${GREEN}Step 1.5: Enabling shared memory...${NC}"
wasm-opt --enable-threads "$WASM_PATH" -o "$WASM_PATH"
# Step 2: Generate JavaScript bindings
echo -e "${GREEN}Step 2: Generating JavaScript bindings...${NC}"
wasm-bindgen "$WASM_PATH" \