Giter Club home page Giter Club logo

Comments (5)

ducan-ne avatar ducan-ne commented on July 29, 2024

Hi @lxsmnsyc I see this already implemented in code but is that not flagged ready to use?

Try to use it with solid start but seem like doesn't work

export const logHello = async function (message: string) {
  'use server'
  console.log(message)

  return {
    title: 'Hello World',
    async* [Symbol.asyncIterator](): AsyncIterator<number> {
      await Promise.resolve()
      yield 1
      await new Promise((resolve) => setTimeout(resolve, 1000))
      yield 2
      await new Promise((resolve) => setTimeout(resolve, 5000))
      yield 3
    },
  }
}
export const logHello = async function * (message: string) {
  "use server";
  console.log(message);

  yield { a: true }
  await new Promise((resolve) => setTimeout(resolve, 5000))

  yield { b: true }
};

from seroval.

lxsmnsyc avatar lxsmnsyc commented on July 29, 2024

@ducan-ne Last time I've tested this this should work. Please provide more info.

from seroval.

ducan-ne avatar ducan-ne commented on July 29, 2024

@lxsmnsyc
The lastest version should show catch the error
https://github.com/ducan-ne/solid-async-generator-reproduction/blob/main/src/actions.tsx
https://github.com/ducan-ne/solid-async-generator-reproduction/blob/main/src/components/Counter.tsx

for await (const value of logHello('Hello')) { not work either

Error

Uncaught (in promise) TypeError: logHello(...) is not a function or its return value is not async iterable

Or

Counter.tsx:20  Uncaught (in promise) {a: true}

This is my first time tried solid start so I'm not sure it's right way to use generator, but that's how we use it js

from seroval.

lxsmnsyc avatar lxsmnsyc commented on July 29, 2024

Okay I've tested this one, this isn't a Seroval problem. Please create an issue in SolidStart.

I intend to clean up this thread since it merits its own issue thread.

from seroval.

ducan-ne avatar ducan-ne commented on July 29, 2024

Okay, thank for your infromation

from seroval.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.