mongo
mongo copied to clipboard
using new ObjectId() breaks fresh island
when I add this to the island
console.log(new ObjectId().toString());
it breaks every islands and signals
but the one from web_bson doesn't
also breaks fresh if I call a function from a collection in island like this
Cars.find().toArray().then((cars) => { console.log(cars); });
can you try using git directly?
import {} from "https://raw.githubusercontent.com/denodrivers/mongo/a49057d/mod.ts";
yes, it stills breaks
here is the whole island
import { signal, useSignal } from "@preact/signals";
// import { Cars } from "../model/car.model.ts";
import { ObjectId } from "https://raw.githubusercontent.com/denodrivers/mongo/a49057d/mod.ts";
// const text = signal("");
// import { ObjectId } from "https://deno.land/x/[email protected]/mod.ts";
export default function TextInput() {
const text = useSignal("");
// Cars.find().toArray().then((cars) => {
// console.log(cars);
// });
console.log(new ObjectId().toString());
return (
<div>
<input
type="text"
value={text.value}
onInput={(event) => {
console.log(event.target);
text.value = event.target.value;
}}
/>
{text}
</div>
);
}
I'm guessing you ran into a Reference Error: Deno is not defined. Fresh islands are isolated preact components and rendered on the client. Fresh Docs Islands
Maybe take a look at Fresh Docs Data Fetching
web_bson is web based it should not use deno api? so im wondering from where the issue is coming from