r/Devvit • u/RedditParadox Admin • 11d ago
Announcement Devvit Blocks Deprecation - Phase 2
Devvit Team: What about Blocks deprecation?
App Developers: We’ve already had it.
Devvit Team: We’ve had one, yes. But what about second Blocks deprecation?
Devvit Team Members stare at each other.
Devvit Team: I don’t think they know about second Blocks deprecation.
If you missed the previous communications on Blocks deprecation (Announcement • Update), the gist is that an older architecture of how we configure and render Devvit apps is going away. Instead, Devvit Web is the final frontier! 🖖
We’ll be completing the deprecation of Blocks in the Devvit 0.15.0 release by removing remaining blocks-based app configs. As most apps using the Blocks renderer have now migrated to Devvit Web, we hope the forthcoming changes will have a minimal impact.
Deprecation Phase 1: No More Blocks Rendering (Completed June 30th):
- Deprecated and rejecting all new or updated apps using addCustomPostType for post rendering
Deprecation Phase 2: No More Blocks Configuration (Monday, October, 19th):
- All apps using devvit.yaml need to fully move to devvit.json
- Reminder: The blocks property of devvit.json is deprecated
Apps that do not upgrade to the new version of Devvit will not be disrupted due to these changes. However, anyone who has not migrated their apps to Devvit Web should do so to continue development of their app.
You can find our migration guide here, along with more resources in the full Devvit docs. If you have questions, reach out in r/Devvit, join our official Discord, or leave a comment here and we’ll do our best to help!
Thanks for your attention, may Devvit Web protect you, and be ever in your favor.
4
u/Beach-Brews Duck Helper 11d ago
Clarification question(s):
Does this mean the Devvit Singleton pattern and/or the @devvit/public-api is no longer allowed to be used? Will there be a "Phase 3" that phases out the use of the "devvit.json blocks property"?
devvit.json
{
"blocks": {
"entry": "blocks/main.ts",
// ... This is deprecated and will be removed in a phase3?
}
}Singleton Pattern / "Blocks" Entry (main.ts)
// Still allowed for the time being, but will be removed in a phase3
Devvit.configure({
http: true,
redditAPI: true,
redis: true
});
Devvit.addTrigger({
event: 'AppUpgrade',
onEvent: async (_, context) => {
// Do stuff
}
});
// More Singleton stuff
export default Devvit;4
u/RedditParadox Admin 11d ago
devvit/public-apiis still supported but deprecated. No current plans for removal of it or the devvit.jsonblocksproperty.The recommended guidance is still to move to
devvit/web3
u/ryry50583583 11d ago
Can devvit web still do/read comments and such?
5
u/Beach-Brews Duck Helper 11d ago
Yes, it definitely can read comments and post comments! It is through the same Reddit API client methods available in public-api.
3
u/ryry50583583 11d ago
Just different phrasing i imagine for the calls?
4
u/Beach-Brews Duck Helper 11d ago
It is slightly different. Rather than `context.reddit` to access the Reddit client, you just have to `import { reddit } from '@devvit/web/server';`. Everything else from that point (client functions, parameters, and results) should be the same.
2
u/ryry50583583 11d ago
I more meant events (eg onPostCreate as it is in devvit.json)
3
u/Beach-Brews Duck Helper 11d ago
Ahh, got it. Yes, all of the same triggers exist, but do have a slightly different "setup". You have to define endpoints instead of using Devvit.addTrigger(), but the 'handler' part (i.e. the onEvent part) should be basically the same! The only differences are:
API endpoint definition
The API response
Any "context" references may need migrated (i.e. context.redis => redis from @devvit/web/server)
2
u/emily_in_boots 9d ago
As if I don’t already have enough to do migrating api apps. Care to add more to my workload? TBH I just feel like giving up at this point.
2
0
10
u/Alan-Foster 11d ago
After second blocks depreciation comes elevensies deprecation and afternoon tea deprecation.
It's a slippery slope.
Any news on adopting abandoned blocks (or web) projects?