Questions tagged [redwoodjs]

What is the JAMstack?

The JAMstack isn’t a specific set of tools, but a new, modern way of building websites & apps. Where does “J-A-M” come from, you may ask? From these three core concepts:

JavaScript: Any dynamic programming during the request/response cycle is handled by JavaScript, running entirely on the client.

APIs: All server-side functions or database actions are abstracted into reusable APIs, accessed over HTTPS with JS. Be it SaaS, third-party services or custom-built.

Markup: Templated markup should be prebuilt at build time, usually using a site generator for content sites, or a build tool for web apps.

Here is the

Latest Release : v0.2.5

Redwood Structure

A Redwood application is split into two parts: a frontend and a backend. This is represented as two node projects within a single monorepo(is a software development strategy where code for many projects is stored in the same repository.).

The frontend project is called web and the backend project is called api. For clarity, we will refer to these in prose as "sides", i.e. the "web side" and the "api side".

Web Side : The web side is built with React. Redwood's router makes it simple to map URL paths to React "Page" components (and automatically code-split your app on each route). Pages may contain a "Layout" component to wrap content.

Api side : The api side is an implementation of a GraphQL API. Your business logic is organized into "services" that represent their own internal API and can be called both from external GraphQL requests and other internal services.

28 questions
5
votes
1 answer

React Testing Library: How to test components that contain useLocation()?

I'm using RedwoodJS which uses React with React Testing Library under the hood. I'm struggling to test a component (and all page components which have this component in the tree) because of the useLocation() hook. When using a useLocation() hook…
Snowman
  • 1,160
  • 1
  • 8
  • 24
4
votes
3 answers

Prisma 2 query to return records only that are associated with ALL of the provided tag IDs

I have tables Principles and Tags. And there is a many-to-many relation between them (joined implicitly). Without using prisma.raw, how can I run the following query? SELECT p.id, p.title, p.description, p.createdAt, p.modifiedAt FROM principle…
Ryan
  • 22,332
  • 31
  • 176
  • 357
3
votes
1 answer

Working with RedwoodJS and Jest. "SYNTAX ERROR : Jest encountered an unexpected token"

I was trying to write some test for my Redwoodjs project. I am using the FullCalendar.io package and jest complains when it encounters the import statements for this package. Here's what it says: Jest encountered an unexpected token Jest failed…
Shriya
  • 43
  • 4
3
votes
2 answers

How to create field resolver on RedwoodJS

RedwoodJS automatically maps GraphQL queries resolvers to api/src/services. How do I create a field resolver for a given GraphQL type? Suppose I have this schema: type Person { name: string! birthDate: DateTime! age: Int! } But only name and…
gfpacheco
  • 2,831
  • 2
  • 33
  • 50
2
votes
1 answer

Function passed as argument to custom React Hook is causing problems

The Need: I am using RedwoodJS for making a Fullstack app. It provides us with hook useAuth() which gives a state isAuthenticated telling if user is logged in or not. I want to make some Queries on Web side whenever user Logs in. Not whenever…
2
votes
2 answers

How can I use "count" and "group by" in Prisma 2?

I have this function which works: export const tagsByLabel = async (params) => { const findManyParams = { where: { userId: userIdFromSession }, orderBy: { title: "asc" }, }; if (params) { const { searchTerm } = params; …
Ryan
  • 22,332
  • 31
  • 176
  • 357
1
vote
1 answer

Set an "odd" image as a responsive full screen background, showing the entire image in React/RedwoodJS

Somewhat odd request here - I need to set an image as a background, for which I would normally use cover, but I need all edges of the image visible at all times (image attached). I've tried all the traditional approaches, but I'm starting to think…
Nick Matthews
  • 91
  • 1
  • 5
1
vote
1 answer

Equivalent of SQL `CASE WHEN...THEN` for custom sort column? (Prisma / GraphQL)

Scenario: Let's assume a model of Events: model Event { id Int @id @default(autoincrement()) title String happeningAt DateTime? // nullable createdAt DateTime @default(now()) } Let's assume this is the…
Philzen
  • 3,945
  • 30
  • 46
1
vote
2 answers

How can I solve error occurred while proxying request? RedwoodJS

I'm following RedwoodJS Tutorial - Getting Dynamic and there's a proxy error when requesting localhost:8910/posts api | API listening on http://localhost:8911/ api | GraphQL endpoint at /graphql api | 11:14:25 Server listening at…
Captain 8
  • 157
  • 1
  • 1
  • 8
0
votes
0 answers

RedwoodJS, Error generating sdl from the given command : Identifier has already been declared

In my RedwoodJS app, I want to create a form with the data from my editorialCalendars table. To do this, I used the command yarn rw g cell editorialCalendars. This command worked. After that, I ran the command yarn rw g sdl editorialCalendars but I…
0
votes
0 answers

Fixed left sidebar using React and Bootstrap5

I have a React app using RedWoodJS framework. I want a header, a footer and a fixed left sidebar with my content to the right. Something like that : https://www.codeply.com/p/w5ZxAjmjpo but with a footer and in React. To add bootstrap to my app I…
0
votes
0 answers

How do i fix the error "unknown type "queryName" " on redwood js?

Using redwood JS framework, i'm trying to make queries to the database using graphQL. problem is that i get an error when i try to generate types : Error 0: Unknown type "FindEditEventQueryVariables". at…
Suplink
  • 31
  • 3
0
votes
0 answers

React createPortal with getelementbyid fails every second time I refresh in Chrome

This code works perfectly every second refresh in Chrome. The other time it complains about the target not being a dom node. Any suggestions as to why it consistently fail on every second refresh? This is a Redwood project using BPMN-JS and it is…
0
votes
0 answers

405 Method Not Allowed after deployment on vercel (using react app)

I have an app using redwood, supabase and prisma. I've just deployed it on vercel and now I can't access to my data. I have an error 405 Method Not Allowed, but I don't understand why, as it works well on localhost. I didn't forget to add env var,…
0
votes
1 answer

Error: P1001: Can't reach database server using prisma, supabase and redwood

I want to do a migration using prisma, supabase and redwood. The problem is that when I try to do yarn redwood prisma migrate dev I get this : error message My schema.prisma : datasource db { provider = "postgresql" url =…
1
2