Sabitlenmiş Tweet
Ivan Babak
7.2K posts

Ivan Babak
@sompylasar
UI engineer, software architect. Enjoy building, maintaining, refactoring complex web apps, components, APIs, tools. Love open source and UI design. 🙌
Katılım Temmuz 2012
193 Takip Edilen404 Takipçiler

@sompylasar @mrdoob this is don't know, need to ask the rt/xr authors. probably just a flag? i didn't get into it to know for sure, i tried quest but just makes me sick in the stomach.
English

@0xca0a @mrdoob I understand it can work, i.e. we can write raw three-js code around r3f, assuming the necessary APIs are not fully hidden inside; for the passthrough, I think, I saw the needed ones exposed. My question was more about anything out-of-the-box-ish, e.g. <XR passthrough={true}>
English

@sompylasar @mrdoob if it works in three it works in fiber. though there is something big coming up next week regarding UI. something that doesn't exist yet for webgl/threejs. keep eyes open. 🫣
English
Ivan Babak retweetledi

I like the way Vercel designs software, I really do. Their attention to detail and DX have been inspiring me for years.
But the decision to patch global "fetch" is borderline wrong. It even results in a poor user experience, counter-intuitively—something I feel was the sole reason of going into this slippery slope of module patching.
Okay, what's happening and why it's bad. Next patches the "globalThis.fetch" function for you. It's a globally available function to perform requests. Why? To support caching: nextjs.org/docs/app/api-r…
And I get it, creating an illusion that you can control cache from your fetch call is neat. Until it's not. I think we as a community have learned that patching things you don't own in JavaScript is a terribly bad idea ever back in jQuery days. I leave the googling to you to educate yourself.
Briefly, it's bad for two main reasons.
First, it misleads the user. It's fair to say that 99% of Next users have never read the Fetch API specification. No shame in that. But what we use gets carved into your mind, and once Next users get used to this really neat caching API that seems to be coming from global fetch but not really, they will just confuse themselves. What will happen is those users will go to a different framework or, damn, just open their DevTools, and will expect "fetch" to handle caching. Only it won't. Because that's not what fetch does, it's not in the spec and is borderline confusing.
The second reason patching fetch is a terrible API design is that it blocks any third-party libraries that rely on module patching. See, not only Next patches fetch but it does it as the very last thing during the framework bootstrapping. This means that no third party can patch fetch themselves. "Wait, you are advocating against patching fetch but now say Next prevent other libs from doing that and it's somehow a bad thing?" Yes, precisely. Keep in mind, some packages have no other choice but to indulge in module patching. API mocking is one bright example, and I have a bit of expertise in that. There are simply no means in Node to intercept requests, so libraries patch request-issuing modules to do that. It's nasty terrible hack but, I stress it once more, there is literally no other way.
But there is a way if you are a framework designing a caching feature. In fact, there are a multitude of ways to achieve it, even preserving the "native-like" feel of that API. Here's but one example:
import { cache } from 'next'
const response = await cache('no-store', fetch(url, init))
I can't say it's a gigantic degradation of user experience, to be honest. I spent a few seconds coming up with this example, I'm certain that a team of some of the best engineers in the field can come up with a much better API here.
All the more confusing why that didn't happen.
This isn't a rant, really, just an observation of how framework features leak into standard code and harm both the users and the ecosystem in the long run. Don't modify things you don't own. That was true a decade ago, it's still true now.
English
Ivan Babak retweetledi
Ivan Babak retweetledi

@DavidKPiano @royalicing Make sure your dependency array contains only values, changes in which should cause the effect init. If something else from the render scope is needed inside of the effect, it has to be taken from a Ref object synced with the render scope values independently via another effect.
English

@royalicing More subtle. Good rule of thumb: make sure your dependency array is only what is needed inside of the effect. The linter may autofix it to be too broad.
English
Ivan Babak retweetledi
Ivan Babak retweetledi

@DavidKPiano Is saving the nextState into the Actor's memory an effect?
English
Ivan Babak retweetledi
Ivan Babak retweetledi

This is brilliant and will save devtools authors many a headache 😁
namechecker.vercel.app

San Francisco, CA 🇺🇸 English
Ivan Babak retweetledi
Ivan Babak retweetledi

@icreatelife Tweeting becomes axing.
A tweet will be called an ax.
English

Ivan Babak retweetledi

Ivan Babak retweetledi
Ivan Babak retweetledi

how to have URL routes inside your scene, as well as bind webgl text to html to that it's accessible, selectable, and webgl gets to refract it.
codesandbox.io/s/router-trans…
English










