Skip to content

Commit

Permalink
Merge pull request #7136 from QwikDev/v2-merge-main
Browse files Browse the repository at this point in the history
chore: merge main into v2
  • Loading branch information
wmertens authored Dec 6, 2024
2 parents 9cdfc58 + 132fa7a commit f10c64d
Show file tree
Hide file tree
Showing 127 changed files with 6,240 additions and 401 deletions.
744 changes: 492 additions & 252 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/docs/src/routes/api/qwik/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2214,4 +2214,4 @@
"mdFile": "core.withlocale.md"
}
]
}
}
29 changes: 29 additions & 0 deletions packages/docs/src/routes/docs/integrations/modular-forms/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,35 @@ export default component$<FormProps>((props) => {
```
By tracking props.login with useTask$, the form fields are dynamically updated whenever the parent provides new values.

## Dealing With Props

Sometimes, you may need to initialize or update the state of your form from the parent component via props. In such cases, you can use the setValue function, as illustrated in the example below:

```tsx
import { setValue, useForm } from "@modular-forms/qwik";

export interface FormProps {
login?: LoginForm
}

export default component$<FormProps>((props) => {
const [loginForm, { Form, Field }] = useForm<LoginForm>({
// rest of the code...
});

useTask$(({ track }) => {
const login = track(() => props.login);
if (!login) return;
for (const [key,value] of Object.entries(login)) {
setValue(loginForm, key, value);
}
});

// rest of the code...
});
```
By tracking props.login with useTask$, the form fields are dynamically updated whenever the parent provides new values.

## Summary

You have learned the basics of Modular Forms and are ready to create your first simple form. For more info and details you can find more guides and the API reference on our website: [modularforms.dev](https://modularforms.dev/)
Expand Down
2 changes: 2 additions & 0 deletions packages/insights/drizzle/0017_pink_maestro.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CREATE INDEX `idx_manifests_apiKey_hash_2` ON `manifests` (`public_api_key`,`hash`);--> statement-breakpoint
CREATE INDEX `idx_manifest_api_timestamp` ON `manifests` (`public_api_key`,`timestamp`);
2 changes: 2 additions & 0 deletions packages/insights/drizzle/0018_heavy_toad.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CREATE INDEX `idx_apiKey_hash_from` ON `edges` (`public_api_key`,`from`,`manifest_hash`);--> statement-breakpoint
CREATE INDEX `idx_hash_to` ON `edges` (`manifest_hash`,`to`);
1 change: 1 addition & 0 deletions packages/insights/drizzle/0019_known_satana.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX `idx_edge_from_to` ON `edges` (`from`,`to`);
Loading

0 comments on commit f10c64d

Please sign in to comment.