Skip to content

Commit

Permalink
default play to 0.11.x (#38)
Browse files Browse the repository at this point in the history
<!-- 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
  • Loading branch information
mwood23 authored Oct 8, 2024
1 parent 19954aa commit 7194c8a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/examples/clock.example.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Devvit} from '@devvit/public-api'
import {Devvit, useState, useInterval} from '@devvit/public-api'

function getCurrentTime() {
const now = new Date()
Expand All @@ -10,10 +10,10 @@ function getCurrentTime() {

Devvit.addCustomPostType({
name: 'Clock',
render: context => {
const [time, setTime] = context.useState(() => getCurrentTime())
render: () => {
const [time, setTime] = useState(() => getCurrentTime())
const tick = () => setTime(() => getCurrentTime())
context.useInterval(tick, 1000).start()
useInterval(tick, 1000).start()

return (
<vstack alignment='center middle' height='100%'>
Expand Down
6 changes: 3 additions & 3 deletions src/examples/hello-blocks.example.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {Devvit} from '@devvit/public-api'
import {Devvit, useState} from '@devvit/public-api'

Devvit.addCustomPostType({
name: 'Say Hello',
render: context => {
const [counter, setCounter] = context.useState(0)
render: () => {
const [counter, setCounter] = useState(0)
return (
<vstack alignment='center middle' height='100%' gap='large'>
<text size='xxlarge' weight='bold'>
Expand Down
8 changes: 4 additions & 4 deletions src/examples/polls.example.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Devvit} from '@devvit/public-api'
import {Devvit, useState} from '@devvit/public-api'

type Tally = [option: string, votes: number]
const tallies: readonly Tally[] = [
Expand Down Expand Up @@ -52,9 +52,9 @@ const Footer = (props: {children?: Devvit.ElementChildren}) => (
Devvit.addCustomPostType({
name: 'Polls Example',
height: 'tall',
render: context => {
const [selection, setSelection] = context.useState('')
const [hasVoted, setHasVoted] = context.useState(false)
render: () => {
const [selection, setSelection] = useState('')
const [hasVoted, setHasVoted] = useState(false)

const VotingScreen = (
<vstack padding='medium' alignment='start' gap='medium' grow>
Expand Down
6 changes: 3 additions & 3 deletions src/examples/progress-bar.example.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {Devvit} from '@devvit/public-api'
import {Devvit, useState} from '@devvit/public-api'

Devvit.addCustomPostType({
name: 'Progress bar example',
render: context => {
const [progress, setProgress] = context.useState(30)
render: () => {
const [progress, setProgress] = useState(30)
return (
<vstack
alignment='center middle'
Expand Down
2 changes: 1 addition & 1 deletion src/storage/settings-save.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const defaultSettings: Readonly<SettingsSave> = {
useLocalRuntime: true,
useRemoteRuntime: false,
useSpeculativeExecution: false,
useUIRequest: false,
useUIRequest: true,
enableLocalAssets: false,
assetsFilesystemType: 'virtual',
version: 1
Expand Down

0 comments on commit 7194c8a

Please sign in to comment.