Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using new ObjectId() breaks fresh island #393

Open
xb1g opened this issue Apr 17, 2023 · 5 comments
Open

using new ObjectId() breaks fresh island #393

xb1g opened this issue Apr 17, 2023 · 5 comments

Comments

@xb1g
Copy link

xb1g commented Apr 17, 2023

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
Copy link
Author

xb1g commented Apr 17, 2023

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

@lucsoft
Copy link
Collaborator

lucsoft commented Apr 17, 2023

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

@xb1g
Copy link
Author

xb1g commented Apr 18, 2023

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

@andrinheusser
Copy link
Contributor

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

@lucsoft
Copy link
Collaborator

lucsoft commented Sep 11, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants