Improve Submissions integration UI#77
Conversation
There was a problem hiding this comment.
Fixed some typical key warnings.
There was a problem hiding this comment.
I was able to get tailwind working with dependencies by resolving absolute paths of the packages.
There was a problem hiding this comment.
This might not be the best approach, but after a few hours of research, this seems like the only/best way to reliably get search parameters in layout components.
There was a problem hiding this comment.
I think the reason Next makes doing this clunky is because they're trying to enforce that if your layout needs to know search params, there's something funky in the route architecture. Since layouts apply to all children (e.g. /, /blog, /blog/1) - they're suggesting that it would be funky to have that top level layout consistently require search params all the way down (as opposed to say, using those params at the appropriate /page.tsx and doing any necessary fetch there).
I understand why you've implemented the approach as you did here, but I can see Next's point too. Perhaps we could load something like /authenticate/page.tsx which reads the search params, and then sets a cookie/localStorage before redirecting to / so that intra-app links aren't required to pass searchParams around forever.
I've fought with Next about this before, and in the end almost always decided that Next was right — and if I thought I needed searchParams in layout.tsx as opposed to page.tsx I was deviating from the intended use of layout and page files.
That said, if it's working - it's working :) And I know there's a deadline, so pure code alignment with Next's opinions doesn't need to be first priority.
There was a problem hiding this comment.
That makes sense. Thanks for the insight. We've talked about using a cookie anyways, so I'll take a stab at the page approach!
isTravis
left a comment
There was a problem hiding this comment.
I think it'd be fine to merge this with the middleware approach. That could always be refactored at a later date. It seems the higher priority is just getting the functionality pushed forward.
If you can see the refactor you'd want to make now though, of course go for it, but I don't think any of the code structure as is should be a blocker for merging.
…act entrypoint to sdk
e734bf2 to
78031ad
Compare
This PR:
@pubpub/sdk/reactentrypoint that exports a few useful boilerplate components for integrationsMost changes are cosmetic, but I would like opinions on fetching data from the root layout, because I'm not sure if that's a good idea or not.
Issue(s) Resolved
N/A
Test Plan
Screenshots (if applicable)