Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Edit tags with connect / disconnect, publish / unpublish #33

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

chris-hailstorm
Copy link

@chris-hailstorm chris-hailstorm commented Apr 1, 2020

This is a general update to the Hammer Blog example. I was diving into that example so I could use it for the RBAC demo (work in progress). I found some things while I was doing that review.

The most relevant feature to a new dev learning from the example is, it demonstrates one way to handle 1:N relations in a service - how to add/drop tags from a post.

CHANGES

  • can add tags to a post from /admin/new
  • can add & drop tags for a post from /admin/_/edit
  • (the above build a connect / disconnect clause)
  • can unpublish a published post from /admin/_/edit
  • old favicon didn't work; added for several standards

BUGS

  • I noted an interesting bug at the end of README - trying to save a post with a duplicate slug causes a GraphQL error, but that doesn't bubble up to the UI - can see it in the console log - seems like something's missing in the Form flow - how should GraphQL errors be handled?

NOTES

  • the way I'm connecting / disconnecting tags works but isn't slick - I think it'd be helpful to have a 1:N picker control (I can package and contribute that), and a standard way to build out a connect / disconnect clause that could be included in scaffold files (not sure if a mechanism already exists in Prisma client or ?? I'm willing to build one if there isn't an existing easy way)

@netlify
Copy link

netlify bot commented Apr 1, 2020

Deploy request for redwood-example-blog accepted.

Accepted with commit d6e9896

https://app.netlify.com/sites/redwood-example-blog/deploys/5e851edaa640d400064c7f09

@cannikin
Copy link
Member

cannikin commented Apr 1, 2020

Hmm, site is busted on deploy: https://deploy-preview-33--redwood-example-blog.netlify.com The graphql endpoint is throwing a 502. Looks like it's looking for the new api/src/lib/db.js which instantiates PrismaClient. We changed that 0.3.2: redwoodjs/redwood#334

@cannikin
Copy link
Member

cannikin commented Apr 1, 2020

@chris-hailstorm Can you try upgrading redwoodjs in this branch to make sure you have 0.3.2 in your lock file? The master branch is building and deploying fine, but yours is blowing up...not being able to find that api/src/lib/db path, that was part of 0.3.0. 0.3.1 and 0.3.2 followed shortly after to fix bugs, apparently 0.3.0 and 0.3.1 don't work at all. 😬

@cannikin cannikin self-requested a review April 1, 2020 17:53
@chris-hailstorm
Copy link
Author

Will do today, thanks

@chris-hailstorm
Copy link
Author

chris-hailstorm commented Apr 1, 2020

@cannikin Bumped to 0.4.0 -- my local tests were good. Netlify build is erroring.

This is my first rodeo with Netlify deployment. I can look into anything you suggest.

Also if you'd prefer, I can open a new PR to try to merge my way past the 2 conflicts.

@chris-hailstorm
Copy link
Author

@cannikin let me know how I should resolve the conflicts. I can always grab the current master and create a fresh PR for that. I'm not clear on how to set the Prisma datasource though.

@cannikin
Copy link
Member

cannikin commented Apr 5, 2020

Did you see we created that netlify plugin to handle changing "sqlite" to "posgresql"? That's in my branch of master, rc-prisma-beta. It creates proper resolvers for Post.tags and Tag.posts and also updates to the Prisma 2.0.0-beta.1 which has some new required syntax on relations in schema.prisma. You could try merging to that and see if the admin forms still work?

@peterp peterp changed the base branch from master to main June 19, 2020 16:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants