Skip to content

EphemeralStore: Recursive aliasing panics #705

Closed
@synoet

Description

@synoet

Calling any method on an EphemeralStore within a callback passed to an EphemeralStore.subscribe panics due to unsafe recursive aliasing.

import { EphemeralStore } from "loro-crdt";

const store = new EphemeralStore();

store.subscribe((update) => {
  // Panics
  const all = store.getAllStates();
  console.log(all);
})

store.set("a", 1);
store.set("b", 2);
store.set("c", 3);

Error:

called `Result::unwrap()` on an `Err` value: JsValue(Error: recursive use of an object detected which would lead to unsafe aliasing in rust
Error: recursive use of an object detected which would lead to unsafe aliasing in rust
....
RuntimeError: Unreachable code should not be executed (evaluating 'wasm.ephemeralstorewasm_set(this.__wbg_ptr, ptr0, len0, addHeapObject(value))')

This might have some good context: rustwasm/wasm-bindgen#1578

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions