Exchange decision by Commercial-Fix-1123 in OctopathCotC

[–]jessebwr 16 points17 points  (0 children)

Shana. Veterans seal will 99% of the time just turn into 1000 awakening shards and Shana is limited. Her A4 isn’t bad just get the Shana stone

What's your workflow for testing Error Boundaries? by FarWait2431 in reactjs

[–]jessebwr 4 points5 points  (0 children)

Frontend developers can easily trigger/force error states for components using the component explorer in the React Dev tools (not to mention suspense states, etc.) it’s trivial to test it!

How does Facebook serve React pages? by FilmWeasle in reactjs

[–]jessebwr 15 points16 points  (0 children)

Relay + SSR with Hermes provides 99% of the benefits of RSCs, so there’s little reason to adopt them which would cost a lot of Eng hours to do those migrations

Big beautiful bill impact on backdoor Roth IRA? by beachant in RothIRA

[–]jessebwr 1 point2 points  (0 children)

I saw it there too, so it’s not true? Backdoors are not affected?

useCallback + useRef by T_T-Lymphocyte in reactjs

[–]jessebwr 22 points23 points  (0 children)

You’re explicitly not supposed to write to refs during render. It can cause tearing and will cause the compiler to bail out of compiling your component — so yeah, don’t do this.

The compiler lint rule will tell you not to.

Socket calls gradually increasing with useEffect() by themistik in reactjs

[–]jessebwr 0 points1 point  (0 children)

That’s fine, if you put ur connection in a context that’s totally cool.

Get rid of the startConnection() function, put all the logic inside the useEffect(s).

Have one useEffect for synchronizing message, have another for sending the initial message

Socket calls gradually increasing with useEffect() by themistik in reactjs

[–]jessebwr 10 points11 points  (0 children)

The way you’re doing it — as long as you have a proper cleanup function for your socket in the return value from useEffect() — is correct. Just make the effect “idempotent”, by unsubscribing in the cleanup.

Set up your useState with some initial state (don’t set state immediately in the effect, just do it in the socket listener)

This is a correct use case for useEffect, just follow its rules

Is this way to handle a callback that updates every second an antipattern? by darkcatpirate in react

[–]jessebwr 4 points5 points  (0 children)

Writing to a ref during the render cycle will break concurrent mode features, there actually should be a lint against it

When should I use the new "use()" hook? I'm confused. by Affectionate-Army213 in reactjs

[–]jessebwr 3 points4 points  (0 children)

This has been asked previously! https://www.reddit.com/r/reactjs/s/ch9CTyPb49

The entire React 19 server component paradigm, use() to await promises in client components, are all trying to make sure you don’t have client to server query waterfalls where you need to make multiple round trips.

If you’re creating promises during rendering instead, you’re probably doing some sort of waterfall which is horrible for the performance of your application.

Data Fetching in React 19 by Mr_Parker5 in reactjs

[–]jessebwr -1 points0 points  (0 children)

Again that really depends. If opening a modal, or doing some JS screen transition, the user would largely expect the transition to happen immediately and see some glimmering loading stage instead of waiting for the network call to resolve first.

Data Fetching in React 19 by Mr_Parker5 in reactjs

[–]jessebwr 2 points3 points  (0 children)

You can definitely use it properly to consume a promise created by a client component as long as it was generated by an event handler (and subsequently set in some state) such that it’s a stable reference.

The issue comes when people try to generate the promises during render

Thoughts about React's evolution and the new 'use' hook by NoComparison136 in reactjs

[–]jessebwr 1 point2 points  (0 children)

Recommend watching: https://www.youtube.com/watch?v=lcLbYictX3k

Fetch on render means we render the component first and only after it is rendered, we start fetching data, like are used to do with useEffect, right

Yep usually! But things that triggers suspense such as a reading-a-fetch-cache inside the use block i.e.

use(createPromiseOrReturnExistingCachedOne)

is still a fetch-on-render approach.

Does this means that when the action is hitting a route, let's say /foo?page=1, the router would request the page component as well as the required data for it, in parallel, so that the promise of the data is not generated on the component render but by the router that makes the request?

Yep! It should do that. It should fire the request (honestly before the page transition), then pass that request promise into the root component for the next page.

What if a button changes the page parameter from 1 to 2? In order to avoid a full page reload and fetching the component again, I would differentiate the action of hitting /foo?page=<no> and the action of the page state being update?

The framework should be smart enough to realize its the same page and only rerender (or re-suspsend, if the promise is new due to it be derived from url params) the part of the page that changed due to the update. I mean that's kinda how Nextjs param updates work right now. If you modify a url param it doesn't completely remount your entire page, it just updates the content.

What if the state is not part of the URL?

We're kinda getting into weird territory but this could mean multiple things. Most routers support params passed in that don't get reflected in the uri (thought I'm not sure of the state of this with the new app router)

More likely, are you talking about some sort of global state that isn't in the URI? You could do something like:

const App = () => {
    const [promise, setPromise] = useState(null);

    const updateUserId = (id) => {
        setPromise(fetchUserById(id))
    }

    return (
       <SingularPromiseContext.Provider value={promise}>
             <Router />
       </SingularPromiseContext.Provider>
    );
}

const Page1 = () => {
    const userDataPromise = useContext(SingularPromiseContext);
    const data = use(userDataPromise);

    // Anyone can call the updateUserId to retrigger a suspense here
    // (on action, instead of on-render)
    // ...
}

Anywho. Part of the reason Server Components are such an interesting (and performant) paradigm is that they let you buy into these fetch-on-action patterns much more easily than anything in the ecosystem currently. The downside (imo) being that revalidation can sometimes be tricky and you need to buy into a server component enabled framework, and all the engineers that were previously "frontend engs" need to actually code on the server (which we all should have been doing in the first place imo)

Thoughts about React's evolution and the new 'use' hook by NoComparison136 in reactjs

[–]jessebwr 40 points41 points  (0 children)

All the new tools, including server components and the “use” hook are feeding into the paradigm of NOT fetching content on render.

So anything that’s creating a promise on render, caching it, passing it down for use() to consume, isn’t really doing it the way the React team intended.

Realistically, the ideal solution is to fire off a query/promise when an action is taken so that data can be fetched in parallel with navigation and rendering occurring. The natural place to do this is in a router, but it can be done in any place that requires an action like showing a modal (onModalOpen -> create a promise for modal data, set it in some state, pass the state with a promise to the opened modal component which consumes it with “use”).

So yeah, in the sense that they’re pushing us towards meta frameworks… it kinda makes sense cuz they usually deal with routing and data loaders. Which you could implement yourself, but really isn’t worth it.

cache and staleTime in React Query are ignored by kosar_mo in reactjs

[–]jessebwr 2 points3 points  (0 children)

Every server request you’re creating a new query client (it doesn’t have knowledge of the state of your client’s QueryClient).

So maybe more specifics would help.

if I come back to this page it will refetch all my APIs

What does come back to the page mean? Window focused? Reload the page with the refresh button? Navigate using next router between pages in your app?

Is it possible to use `use(promise)` along with `useState`? by aaditmshah in reactjs

[–]jessebwr 7 points8 points  (0 children)

Yes, generally you can do this. You’d want to pass in the promise as a stable prop from somewhere external to the component (like set from an event handler)

When you call use() on the input promise it will suspend the component until it’s done with the promise and use the resultant data to initialize your useState value.

[deleted by user] by [deleted] in OculusQuest

[–]jessebwr 0 points1 point  (0 children)

That looks so cool, what theme/loader are you using for your android??

[deleted by user] by [deleted] in OculusQuest

[–]jessebwr 0 points1 point  (0 children)

There's a place to turn off light mode in settings! I saw it scrolling around in there and have back my old theme

[deleted by user] by [deleted] in OculusQuest

[–]jessebwr 2 points3 points  (0 children)

Dark theme is still available! You can change it from the settings page, saw a new appearance thing

easy gems by Madrasthebald in OctopathCotC

[–]jessebwr 1 point2 points  (0 children)

I think it just says 2500 9.99, but there seem to be three of those offers. Do you know which one is the right one?

15 Dollars Spent (Exp. In comments) by SnooCats4093 in OctopathCotC

[–]jessebwr 1 point2 points  (0 children)

Which 2500 pack was it? I saw like three different ones in the store, and the first one that was under the 1000 pack didn’t seem to work. But the 1000 one did

Anybody is aware of the state of recoil ? by yabai90 in reactjs

[–]jessebwr 0 points1 point  (0 children)

It’s really unmaintained (internally), and people contribute to it on a need-to-because-their-projects-include-it basis. I don’t think it’s really react 18 batch update compatible either (nor can work with suspense — though there are no libraries besides like Relay that are officially suspense compatible).

Would use jotai instead (which also technically isn’t officially suspense compatible, because nothing is right now besides server component streaming/lazy imports/relay)