Skip to content

Commit b389cb7

Browse files
authored
Merge pull request #350 from oasisprotocol/mz/fixAppInitState
Remove template specific values from init app data state
2 parents 6264b31 + 70ab4d8 commit b389cb7

5 files changed

Lines changed: 30 additions & 13 deletions

File tree

.changelog/350.bugfix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove template specific values from init app data state

src/pages/CreateApp/HlCopyTraderForm.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ export const HlCopyTraderForm: FC<HlCopyTraderFormProps> = ({
2020
}) => {
2121
const form = useForm<HlCopyTraderFormData>({
2222
resolver: zodResolver(hlCopyTraderFormSchema),
23-
defaultValues: { ...inputs },
23+
defaultValues: {
24+
secrets: {
25+
COPY_TRADE_ADDRESS: '',
26+
WITHDRAW_FUNDS_TO: '',
27+
WITHDRAW: 'false', // Hidden, not editable, prefilled WITHDRAW="false"
28+
},
29+
...inputs,
30+
},
2431
})
2532

2633
function onSubmit(values: HlCopyTraderFormData) {
@@ -44,8 +51,6 @@ export const HlCopyTraderForm: FC<HlCopyTraderFormProps> = ({
4451
placeholder="0x..."
4552
/>
4653

47-
{/* Hidden prefilled WITHDRAW="false" */}
48-
4954
<CreateFormNavigation handleBack={handleBack} disabled={form.formState.isSubmitting} />
5055
</form>
5156
)

src/pages/CreateApp/TgbotAgentForm.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ export const TgbotAgentForm: FC<TgbotAgentFormProps> = ({
2121
}) => {
2222
const form = useForm<AgentFormData>({
2323
resolver: zodResolver(tgbotFormSchema),
24-
defaultValues: { ...inputs },
24+
defaultValues: {
25+
secrets: {
26+
OLLAMA_MODEL: '',
27+
TOKEN: '',
28+
OLLAMA_SYSTEM_PROMPT: '',
29+
},
30+
...inputs,
31+
},
2532
})
2633

2734
function onSubmit(values: AgentFormData) {

src/pages/CreateApp/XAgentForm.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,19 @@ type XAgentFormProps = {
1616
export const XAgentForm: FC<XAgentFormProps> = ({ handleNext, handleBack, inputs, setAppDataForm }) => {
1717
const form = useForm<XAgentFormData>({
1818
resolver: zodResolver(xAgentFormSchema),
19-
defaultValues: { ...inputs },
19+
defaultValues: {
20+
secrets: {
21+
SYSTEM_PROMPT: '',
22+
TWITTER_BEARER_TOKEN: '',
23+
TWITTER_API_KEY: '',
24+
TWITTER_API_SECRET: '',
25+
TWITTER_ACCESS_TOKEN: '',
26+
TWITTER_ACCESS_TOKEN_SECRET: '',
27+
OPENAI_API_KEY: '',
28+
OPENAI_MODEL: '',
29+
},
30+
...inputs,
31+
},
2032
})
2133

2234
function onSubmit(values: XAgentFormData) {

src/pages/CreateApp/useCreate.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ const initAppDataState = (network: 'testnet' | 'mainnet'): AppData => ({
1111
version: '',
1212
homepage: '',
1313
},
14-
inputs: {
15-
secrets: {
16-
OLLAMA_MODEL: '',
17-
TOKEN: '',
18-
OLLAMA_SYSTEM_PROMPT: '',
19-
WITHDRAW: 'false',
20-
},
21-
},
2214
network: network,
2315
build: {
2416
provider: '',

0 commit comments

Comments
 (0)