diff --git a/web/pages/create.tsx b/web/pages/create.tsx
index ab566c9e..92a5964f 100644
--- a/web/pages/create.tsx
+++ b/web/pages/create.tsx
@@ -56,12 +56,6 @@ export default function Create(props: { auth: { user: User } }) {
const { user } = props.auth
const router = useRouter()
const params = router.query as NewQuestionParams
- // TODO: Not sure why Question is pulled out as its own component;
- // Maybe merge into newContract and then we don't need useEffect here.
- const [question, setQuestion] = useState('')
- useEffect(() => {
- setQuestion(params.q ?? '')
- }, [params.q])
if (!router.isReady) return
@@ -76,26 +70,7 @@ export default function Create(props: { auth: { user: User } }) {
@@ -103,12 +78,9 @@ export default function Create(props: { auth: { user: User } }) {
}
// Allow user to create a new contract
-export function NewContract(props: {
- creator: User
- question: string
- params?: NewQuestionParams
-}) {
- const { creator, question, params } = props
+function NewContract(props: { creator: User; params?: NewQuestionParams }) {
+ const { creator, params } = props
+ const [question, setQuestion] = useState('')
const { groupId, initValue } = params ?? {}
const [outcomeType, setOutcomeType] = useState(
(params?.outcomeType as outcomeType) ?? 'BINARY'
@@ -131,6 +103,11 @@ export function NewContract(props: {
}
})
}, [creator.id, groupId])
+
+ useEffect(() => {
+ setQuestion(params?.q ?? '')
+ }, [params?.q])
+
const [ante, _setAnte] = useState(FIXED_ANTE)
// If params.closeTime is set, extract out the specified date and time
@@ -254,6 +231,26 @@ export function NewContract(props: {
return (
+
+
+