mongo icon indicating copy to clipboard operation
mongo copied to clipboard

using new ObjectId() breaks fresh island

Open xb1g opened this issue 2 years ago • 5 comments

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

xb1g avatar Apr 17 '23 08:04 xb1g

also breaks fresh if I call a function from a collection in island like this Cars.find().toArray().then((cars) => { console.log(cars); });

xb1g avatar Apr 17 '23 08:04 xb1g

can you try using git directly? import {} from "https://raw.githubusercontent.com/denodrivers/mongo/a49057d/mod.ts";

lucsoft avatar Apr 17 '23 10:04 lucsoft

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>
  );
}

xb1g avatar Apr 18 '23 06:04 xb1g

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

andrinheusser avatar Sep 02 '23 21:09 andrinheusser

web_bson is web based it should not use deno api? so im wondering from where the issue is coming from

lucsoft avatar Sep 11 '23 15:09 lucsoft