Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] - Prefer return { label: string; value: string }[] over string[] in dynamic-options widget #256

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions docs/reference/widgets/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export interface Props {
}
```

`mystore/loaders/produtos.ts`
`mystore/loaders/products.ts`
```ts
import { FnContext, allowCorsFor } from "deco/mod.ts";

Expand All @@ -142,6 +142,19 @@ export default function ProductsLoader(_props: unknown, req: Request, ctx: FnCon
ctx.response.headers.set(name, value);
});

return ["Product X", "Product Y", "Product Z"];
return [
{
label: "Product X",
value: "X"
},
{
label: "Product Y",
value: "Y"
},
{
label: "Product Z",
value: "Z"
}
];
}
```
15 changes: 14 additions & 1 deletion docs/reference/widgets/pt.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,19 @@ export default function ProdutosLoader(_props: unknown, req: Request, ctx: FnCon
ctx.response.headers.set(name, value);
});

return ["Produto X", "Produto Y", "Produto Z"];
return [
{
label: "Produto X",
value: "X"
},
{
label: "Produto Y",
value: "Y"
},
{
label: "Produto Z",
value: "Z"
}
];
}
```