Skip to content

Commit 7194c8a

Browse files
authored
default play to 0.11.x (#38)
<!-- If this pull request closes an issue, please mention the issue number below --> Closes # <!-- Issue # here --> ## 💸 TL;DR <!-- What's the three sentence summary of purpose of the PR --> Defaults the playground to use UIRequest (0.11.x) architecture. ## 📜 Details [Design Doc](<!-- insert Google Doc link here if applicable -->) [Jira](<!-- insert Jira link if applicable -->) <!-- Add additional details required for the PR: breaking changes, screenshots, external dependency changes --> ## 🧪 Testing Steps / Validation <!-- add details on how this PR has been tested, include reproductions and screenshots where applicable --> ## ✅ Checks <!-- Make sure your pr passes the CI checks and do check the following fields as needed - --> - [ ] CI tests (if present) are passing - [ ] Adheres to code style for repo - [ ] Contributor License Agreement (CLA) completed if not a Reddit employee
1 parent 19954aa commit 7194c8a

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

src/examples/clock.example.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Devvit} from '@devvit/public-api'
1+
import {Devvit, useState, useInterval} from '@devvit/public-api'
22

33
function getCurrentTime() {
44
const now = new Date()
@@ -10,10 +10,10 @@ function getCurrentTime() {
1010

1111
Devvit.addCustomPostType({
1212
name: 'Clock',
13-
render: context => {
14-
const [time, setTime] = context.useState(() => getCurrentTime())
13+
render: () => {
14+
const [time, setTime] = useState(() => getCurrentTime())
1515
const tick = () => setTime(() => getCurrentTime())
16-
context.useInterval(tick, 1000).start()
16+
useInterval(tick, 1000).start()
1717

1818
return (
1919
<vstack alignment='center middle' height='100%'>

src/examples/hello-blocks.example.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {Devvit} from '@devvit/public-api'
1+
import {Devvit, useState} from '@devvit/public-api'
22

33
Devvit.addCustomPostType({
44
name: 'Say Hello',
5-
render: context => {
6-
const [counter, setCounter] = context.useState(0)
5+
render: () => {
6+
const [counter, setCounter] = useState(0)
77
return (
88
<vstack alignment='center middle' height='100%' gap='large'>
99
<text size='xxlarge' weight='bold'>

src/examples/polls.example.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Devvit} from '@devvit/public-api'
1+
import {Devvit, useState} from '@devvit/public-api'
22

33
type Tally = [option: string, votes: number]
44
const tallies: readonly Tally[] = [
@@ -52,9 +52,9 @@ const Footer = (props: {children?: Devvit.ElementChildren}) => (
5252
Devvit.addCustomPostType({
5353
name: 'Polls Example',
5454
height: 'tall',
55-
render: context => {
56-
const [selection, setSelection] = context.useState('')
57-
const [hasVoted, setHasVoted] = context.useState(false)
55+
render: () => {
56+
const [selection, setSelection] = useState('')
57+
const [hasVoted, setHasVoted] = useState(false)
5858

5959
const VotingScreen = (
6060
<vstack padding='medium' alignment='start' gap='medium' grow>

src/examples/progress-bar.example.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {Devvit} from '@devvit/public-api'
1+
import {Devvit, useState} from '@devvit/public-api'
22

33
Devvit.addCustomPostType({
44
name: 'Progress bar example',
5-
render: context => {
6-
const [progress, setProgress] = context.useState(30)
5+
render: () => {
6+
const [progress, setProgress] = useState(30)
77
return (
88
<vstack
99
alignment='center middle'

src/storage/settings-save.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const defaultSettings: Readonly<SettingsSave> = {
4040
useLocalRuntime: true,
4141
useRemoteRuntime: false,
4242
useSpeculativeExecution: false,
43-
useUIRequest: false,
43+
useUIRequest: true,
4444
enableLocalAssets: false,
4545
assetsFilesystemType: 'virtual',
4646
version: 1

0 commit comments

Comments
 (0)