Really weird TypeScript behavior
Hey. I have this really weird type inference error. So the types do get inferred correctly, as you can see in the first screenshot below. However, when I actually want to call the function the types disappear and become type
never 👀
The type inference correctly picks up the fact that the function parameters can either be "1" and no arguments, or "2" and no arguments....noob question - expo react native - react navigation modal issue
I need help with react-navigation’s modal component. At the moment the modal opens in front of the screen from which it is called from which is what i want.
But when i close it, it does not refresh the screen from where it was called from via use navigation.goBack().
This makes sense as the screen is not destroyed. It sits behind the modal, But that screens data is being updated via the model so i need it to reflect that update immediately upon the modal closing. I’m using react query. ...
Benchmarking slow LCP and TTI
I'm looking for advice on this, because I really don't have a mentor to turn to and I'm feeling pretty lost overall. I've detailed before that I'm refactoring a SPA made with CRA that is meant to replace an AngularJS app that was mounted inside a JSP and served as our previous "version" of this page. I've improved performance quite a bit compared to where it was, but I'm still seeing a rather large gap, and I'm trying to audit A) How much can I reasonably improve performance, and B) Where should I look for benefits at this point?
For a bit more context - because the old application is in a JSP, it gets served HTML from our server which contains a pre-computed JSON string that is parsed and added to the page's service. The new version lives in an S3 bucket and sends multiple requests out for data upon page load. I originally thought this was the primary source of difference remaining between the two applications, because naturally sending to a remote server for data will be slower than parsing JSON that is passed alongside HTML. However, I experimented with removing those calls and simply parsing out a hard-coded JSON string with data, and I'm still reading a significant difference in mobile score (around 56 for the new vs 80-85 for the old page).
When I profile the page (CPU 4x throttled, network fast 3G) I'm noticing a significant difference in the number of long tasks that appear to be falling under the umbrella of React-DOM vs the number that happen on the old AngularJS environment. I've attached screenshots of the trace, in case anything seems fishy. I genuinely don't really know how to interpret these results - does React-DOM often struggle when network/processing speeds are throttled, more so than this other app would?...

tRPC useQuery ReturnType
Working on a custom auth provider (just wanted to do all the stuff myself, learn the flow, ya know) and trying to get the result of a trpc
useQuery passed through context. I can't seem to figure out how to type the context, as the data always comes out as unknown.
```ts
import { procedure, router } from "../t";
...Are these Prisma models okay?
Hey I'm trying out prisma and I'm attempting to make a bug tracker. Just wondering if these models seem fine or if there's anything I can do to make them "better".
Most bug trackers have a bunch of different roles but I'm new to this so I'm keeping it simple with just a user and an admin (me). Then a project manager which is just the user who created the project so they wouldn't have a role the actual project would have a manager and a user would have a list of projects they manage I think?
For the user model I haven't hooked up NextAuth or anything yet so I'll probably have more fields when I get that far. Just trying to get the initial setup goin. I've seen examples with Account and User with a bunch of information that comes from NextAuth....

Augment user type in JWT callback
I am trying to get access to
user.role here, but no matter how I alter the next-auth.d.ts, it doesn't seem to change this user object.```ts
callbacks: {
jwt: async ({ token, user }) => {
if (user) {
token.id = user.id;...Better way to this kind of UI in react (State Based)?
```jsx
{playState === PLAY_STATE.NOT_STARTED && "Debug Mode"}
{playState === PLAY_STATE.PLAYING && (
<div className="flex items-center gap-x-1">...
TypeScript Mapped Types
Hey. I have this type which uses mapped types to generate this other type. It works a little bit, but I'd like it to generate a different type of type union.
Comment on a text document
Hi
I have a document.
I want to set comments on a specific part of the text.
For commenting I add a span to that part.
...
ELI5 TailwindCSS vs Material UI
Backend engineer looking to build some fullstack stuff. Can someone explain the difference between tailwind and material ui? Does a repo only need one or the other?
Solve migration conflicts
This is a complete noob question, but I'm new to db management and migration in general, and I can't find what I'm looking for in the prisma docs: https://www.prisma.io/docs/concepts/components/prisma-migrate
Over time my prisma.schema changes. I want to migrate my existing data.
If there is a new field being added to a table, it's no big deal as long as it's nullable or has a default value set in the schema.
But if I want to make it required or do something else that requires manual explanation on how to do things, how do I tell prisma?...
Middleware redirect
I am currently having issues redirecting users to the login screen. User story: a user is not logged in and they click the 'dashboard' button, the button should redirect them to the nextauth login screen.
SSE - is it efficient to handle SSE this way?
I just learned about SSE and it seems each article is explaining SSE using an interval to write data to the stream.
isn't that going to cost more cpu and memory? especially that each request to the server is going to create another async function that is constantly checking for data change.
how can I trigger a stream-write whenever a database write has been made or something similar that is more precise?
how do I associate the session id with the actual user? can I include a cookie in the request?...
for next-auth how to include a different model to a User Object
```
user {
id: 'cla6t4y450000rpsvp6eijgdh',
name: 'Batman',
email: 'batman@gmail.com',...
How to handle Primsa DateType (JS Date) in getStaticProps | getServersideProps
I keep running into serialization issues when working with schemas that include a DateType since they are transformed into JS Date which is not JSON serializable.
Atm I am transforming the Dates into numbers (miliseconds) to then pass to the component. But of course typescript is complaining. I wrote a generic that replaces Date types with number types inside another type but so far this does not work for nested types.
There has to be a better way. Pls help....
is trpc + prisma right for my problem
Hello, let's say I want functionality add to favorites in my webapp. I have user session from next auth. Currently I am storing items inside User model in my database and then mutating and displaying items with help of trpc on frontend. But the problem is that all users see the same list of items. I have tried to filter it by user id but the issue is that now if one user adds Item to favorites, the other can not because its already there but filtered. Now I think that maybe I am overcomplicating...
Make Zod.string() handle empty string as undefined
Having a schema like
I want
z.string().min(4)
z.string().min(4)
"" to throw Field X is required and "abc" to throw Field X must contain at least 4 characters....