Skip to content

Support default Object.toJSON for serialization of queries #21

@William-Francis

Description

@William-Francis

Description

When making a query like:

   const libraryInventory = await db.from.libraryInventory
    .join(Book, (lib, book) => lib.bookId === book.bookId)
    .toArray(); 

In NextJs: The object needs to be serialized before it can be passed to a client component

Problem Statement/Justification

Screenshot 2024-03-12 at 17 10 51

Example code:

const libraryInventory = await db.from.libraryInventory
    .join(Book, (lib, book) => lib.bookId === book.bookId)
    .toArray();

    return (
    <>
    {libraryInventory.map((libraryInventoryItem, index) => (
            <LibraryItem
              key={"lib-" + index}
              {...libraryInventoryItem}
              // libraryInventoryItem={JSON.stringify(libraryInventoryItem)} // This would be a workaround
            />
          ))}
     <>

Metadata

Metadata

Assignees

No one assigned

    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