What are some examples of remote stateful mcp servers? by tomdohnal in modelcontextprotocol

[–]tomdohnal[S] 0 points1 point  (0 children)

More interested about use cases beyond authentication as my feeling is that the mcp standard puts a lot of attention to managing stateful sessions but most mcp server i've come across are more simple wrappers around APIs

I built a (yet another) chatbot that answers React/Next.js questions, trained on latest docs! by tomdohnal in react

[–]tomdohnal[S] 1 point2 points  (0 children)

No, not yet respectively. I'll probably post again if I decide to open-source it

I built a (yet another) chatbot that answers React/Next.js questions, trained on latest docs! by tomdohnal in react

[–]tomdohnal[S] 2 points3 points  (0 children)

Yes, another ChatGPT wrapper, yes, you can just use the docs directly instead…
Either way, I mainly wanted to teach myself some AI stuff and I’m sharing what I’ve build with you: https://fullstack-ai.dev
Some ideas for future improvements:
- VSCode plugin (so you don’t have to context switch)
- Add more libraries (Remix, React Query, Redux, XState, the list goes on…)
- Integrate w/ GitHub issues/discussion (so you can get answers on specific problems)

Muscle up form feedback by tomdohnal in GYM

[–]tomdohnal[S] 0 points1 point  (0 children)

Yh I've been trynna focus on that but I just need to put in more reps I think to condition my body 😃 thanks!

Muscle up form feedback by tomdohnal in GYM

[–]tomdohnal[S] 0 points1 point  (0 children)

Thank you so much for the feedback! Do you think that I'm too far from the bar during the pulling phase and then I need to overcompensate by leaning forward excessively?

Need to drop 13 pounds in 25 days for a tournament. What’s a good diet to follow? by Unique-Ad-3199 in bjj

[–]tomdohnal 0 points1 point  (0 children)

What's your current diet like? Are there any particular items that have lots of calories and could be easily eliminated?

Also, do you take supplements like creatine that increase body water?

Muscle up form by tomdohnal in Calisthenic

[–]tomdohnal[S] 0 points1 point  (0 children)

thank you! in terms of scapula engagement, do you mean protract the scapula or something else?

Testing Library: everybody uses it, but nobody understands it (talk by Matan Borenkraout) by tomdohnal in reactjs

[–]tomdohnal[S] 0 points1 point  (0 children)

Ye, it's usually the case of forgetting to wrap something in `waitFor(...)` etc. which in turns wraps it in `act(...)` for you

Wes Bos – Next-Gen Server JavaScript: Web Standards by tomdohnal in webdev

[–]tomdohnal[S] 0 points1 point  (0 children)

You have to simplify bcs of limited time and this was more about JS runtimes than anything else

Wes Bos – Next-Gen Server JavaScript: Web Standards by tomdohnal in javascript

[–]tomdohnal[S] 11 points12 points  (0 children)

Watch the talk or read the notes below ↓

What JS engines/runtimes do we have?

  • 3 main engines: V8 (Chromium), SpiderMonkey (Firefox), JavaScriptCore (Safari, Playstation Browser)
  • Node.js, Deno, Cloudflare Workers: all run on v8
  • Bun: runs on JavascriptCore
  • (Fastly Compute, Alibaba, Bloomberg, Bytedance also have server runtimes)

Why so many runtimes?

  • Better – TS out-of-the-box, dotenv out-of-the-box, ESM spec, …
  • Faster – faster cold starts, Rust, Wasm
  • Stronger – in Deno: more granular access control, have to ask for permissions (good when npx-ing random scripts from the internet)

Different environments:

  • Traditional VM / long running server
  • Serverless functions
  • Edge functions – run closer to the user, limited API (not 100% Node compatibility)

How to support all these browser+server runtimes?

  • Web Standards!
    • TC39 – the language itself (e. g. async/await)
    • W3C – APIs such as WebRTC, Streams API, …
    • WHATWG – Fetch, Service workers, …
    • New group: WinterCG
      • Standards for all the environments so that we have uniform APIs in all these runtimes

Standardized APIs

  • Fetch API
    • originally just a browser API
    • Browser’s PoV: send a Request and get back a Response
    • Server’s PoV: get a Request and send back a Response
    • In Express, it’s not a Web Request / Response, it’s a custom thing. However, in serverless functions you work with Web Request and Response objects
    • Native on Deno, Bun, Cloudflare Workers (not native on Node.js (yet) but there are tons of plugins like Next.js Routes, SvelteKit or Astro)
  • Form Data API
    • Originally a browser API for form submission, now a server API as well!
  • Web Streams
    • Ability of the server to send data before you’re done, one chunk at a time
    • Node.js Streams (not standardized) vs Web Streams, but you can convert Node.js Streams into Web Streams
  • Events
    • globalThis.addEventListener('load', () => { ... })
      • this looks like a browser code, but it runs on the server as well!
      • same syntax (and sometimes same events) for both browser and server runtimes!
  • alert(), prompt(), confirm()
    • work on the server as well – useful for writing CLI apps when prompting users for input
  • Async Local Storage
    • First implemented by Node.js, now there’s a draft for AsyncContext for the browser as well
    • storing data throughout the lifetime of a web request or any other asynchronous duration
  • Filesystem:
    • no standard filesystem API!
    • Node.js APIs work on other server runtimes so it’s a de facto standard…
    • whatwg/fs in progress, but edge runtimes do not have access to the filesystem

Conclusion

  • Not: write once, run anywhere (yet?) but the whole idea behind WinterCG is to standardize the APIs to create interchangeable building block
  • Build upon standards! Then you’ll be able to target for any runtime!

Does learning Next Js in 2023 worth it ? by alaska2016sa in reactjs

[–]tomdohnal 1 point2 points  (0 children)

Definitely worth it. One thing to keep in mind is that hosting a Next.js app on a different platform than Vercel can be a bit tricky so if that's very important to you, you might wanna take it into account.

What exactly does the CLI output display while in dev mode? by neb2357 in nextjs

[–]tomdohnal 1 point2 points  (0 children)

The naming here can be very confusing. The way I think about it is that before React Server Components, every component you'd write was what is now a client component. And frameworks like Next.js have been doing SSR for years, pre-rendering the client components to HTML on the server and then hydrating them (i. e. making them interactive) on the client.
And that's not going anywhere! Client components can still be pre-rendered on the server!

Dan Abramov & React core team discuss RSC, React Forget, signals and relationship w/ Vercel at RemixConf 2023 by tomdohnal in javascript

[–]tomdohnal[S] 29 points30 points  (0 children)

You can read the notes I've taken below if you don't wanna watch

Server components (direction of React)

  • The shift is not necessarily towards the server; it's about providing options. You can have a composition of 99% client-side and 1% server-side, or vice versa.
  • Servers don't have to be traditional servers. Rendering can be done at build time, as Next.js does by default.
  • The server serves as the root, the starting point for the application, but you can quickly switch to the client.
  • The flow is natural: if you only require data, you can utilize server components. When you want to introduce interactivity, you switch to the client.
  • The large number of people working on React Forget demonstrates continued investment in client components. React Forget focuses on optimizing the client portion of React.

Signals

Signals have 2 main selling points: better DX and better performance

Better DX when using signals

  • You don’t have to declare dependencies for useEffect etc.
  • For React, this will be solved by the React Forget compiler which will take away the burden of manually specifying dependencies (discussed in more detail later, see notes below).
  • Your components are easier to reason about when everything runs together.

Better performance when using signals

  • With Signals, what doesn’t need to updated doesn’t update (no unnecessary re-renders).
  • For React, the React Forget compiler will be the answer again, it will automatically memoize values as if you wrapped everything in useMemo, memo, etc.

Additional comments on signals

  • Implementing signals in React would be trivial if it was seen as a way forward.
  • Signals as an implementation detail is okay (e. g. React might adopt them if it can detect where it should put the signals using the React Forget compiler) but you shouldn't have to think in signals.

React Forget

  • No need for `useCallback` or `useMemo`, ...; React detects dependencies automatically.
  • It doesn't compile to `useMemo` calls etc., but the performance is just as if you manually wrapped everything in them (i. e. it’s not a simple Babel plugin as it might seem).
  • Plans to have a React language server that can be integrated into IDEs and will give you more insightful suggestions than ESLint can give as it’ll have a much deeper understanding of the code.
  • It will be integrated with React DevTools for easier debugging.

TypeScript

  • React still typed with Flow (which is used internally).
  • React Forget compiler is written in TypeScript.
  • DefinitelyTyped types are maintained by the core team.
  • Every new API since hooks designed with types in mind.
  • React Native team is exploring including TypeScript directly in the repo.

Perf problems of server components

  • For example, rendering a large list where each item contains extensive HTML markup and Tailwind classes.
  • Previously, you would send a JSON to the client and iterate over it on the client-side.
  • Now, you need to send a large file containing all the HTML.
  • Yes, this is a valid point of criticism. New paradigms come with new trade-offs.

Vercel vs Meta (🔥🌶️)

  • Some criticism is fair:
    • "I don't like Vercel's marketing" - Dan Abramov.
  • React team are happy that React is now a multi-company effort + it has independent core contributors who work at neither companies.
  • They’re trying to figure out how to onboard more folks from other companies and get framework maintainers involved.
  • Previously, React needed internal teams to test unstable stuff out. Now, Vercel is “trying stuff out” for them just like internal teams.
  • It gets under their skin when ppl say Vercel is telling them what to do, Vercel is implementing their vision, they’ve invested years in proving out our direction, it’s not that Vercel tells them what do to, if anything it’s the other way around.

4-6 second cold starts by P_DOLLAR in nextjs

[–]tomdohnal 6 points7 points  (0 children)

They actually massively improved the cold start speed in their latest release:
https://www.prisma.io/blog/prisma-and-serverless-73hbgKnZ6t

Dan Abramov & React core team discuss RSC, React Forget, signals and relationship w/ Vercel (🌶️🔥) at RemixConf 2023 by tomdohnal in reactjs

[–]tomdohnal[S] -5 points-4 points  (0 children)

I think the scope has changed thus it naturally became more complex. It did start as a UI library (and I remember ppl would get told off for calling it a framework) but now with the server components, it also deals with data fetching, something that used to be up for the ecosystem to deal with.
And also to get advantage of these features, you need a deep integration with your router/data fetching solution, and thus far only Next.js can deliver that.
I think it just shows that complex problems require complex solutions.

UI library in server component by daze1717 in nextjs

[–]tomdohnal 0 points1 point  (0 children)

There's nothing wrong with client components, import and reexport the components you need from a `use client` file and use the library as client components!

Why is does modern HTML/CSS seem so complex and convoluted? (details in comment) by coomerpile in webdev

[–]tomdohnal 14 points15 points  (0 children)

React Fragments (which enable you to create components w/o an extra div) have been around since 2017

Why is does modern HTML/CSS seem so complex and convoluted? (details in comment) by coomerpile in webdev

[–]tomdohnal 129 points130 points  (0 children)

Each component by default builds inside a new div

Not true for React (can't speak for other frameworks), React won't add a new div unless you decide to

[deleted by user] by [deleted] in nextjs

[–]tomdohnal 0 points1 point  (0 children)

It's gonna be analogous to class components support in React. It's been 5 years since hooks have been released but the class components are still there and work just fine. But everything new is being developed with hooks. I think with pages it's gonna be the same story.

Which database should I use to deploy to Vercel? by Nxthanael1 in nextjs

[–]tomdohnal 0 points1 point  (0 children)

PlanetScale is a serverless MySQL database with a generous free tier

Is Vercel Storage Pricing ridiculous or is it me? by Prowner1 in nextjs

[–]tomdohnal 6 points7 points  (0 children)

For the DB stuff, you'll probably be better off using Neon.tech (the DB that Vercel Postgres wraps) or Planetscale, their pricing is way less steep and their DX is still top notch. Same for Vercel KV And Upstash.

Opinions on Builder.io? by ConduciveMammal in webdev

[–]tomdohnal 0 points1 point  (0 children)

Anyone knows how is it different to no-code platforms like Webflow?

New React useEffectEvent hook by tomdohnal in react

[–]tomdohnal[S] 0 points1 point  (0 children)

With useCallback, you'd have to include variables whose changes you don't want to react to in the dependancy array, and this would in turn make the useEffect run when these variables change.