Passing stuff into cells without adding a parameter to the sdl

hey everyone,

I was wondering if I can pass props into a cell without using them in the graphql query :thinking:

do cells expose some additional prop for extra props aside from “variables”?

I think that you can add the add SuccessProos are shown in redwood/createCell.tsx at 4342d6957a777a959d81fc41bb2c3ed82000f15e · redwoodjs/redwood · GitHub

 * Cell component props which is the combination of query variables and Success props.

I’m not 100% certain, but I believe you can pass them on the cell props for the success component to use.

These are in addition to graphql variables.

An example might help to see if this is possible or not.

Like @dthyresson pointed, you can pass props apart from query variables and it would be available in Cell (Success, Failure, Empty).

For example, if you have this somewhere in react

<GoodCell notAVar="test" />

and then you can use notAVar in GoodCell.tsx

export const Success = ({
}: CellSuccessProps<GoodPeopleQuery> & { notAVar: string }) => (

Just one thing to note is, that any changes to props even if it’s not a query variable, it’ll re-trigger the GraphQL call. This is harmless in most cases, but if you want, you can explicitly pass variables and that’ll prevent unnecessary calls:

In cell

export const beforeQuery = (props) => {
  const { theVarINeed, ..._rest } = props
  return {
    variables: {
    fetchPolicy: 'cache-and-network',
1 Like