-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: update prompt config page (PR 1) #286
Conversation
...app/[locale]/projects/[projectId]/applications/[applicationId]/config-create-wizard/page.tsx
Outdated
Show resolved
Hide resolved
...[locale]/projects/[projectId]/applications/[applicationId]/configs/[promptConfigId]/page.tsx
Outdated
Show resolved
Hide resolved
...ectId]/applications/[applicationId]/config-create-wizard/prompt-config-testing-form.spec.tsx
Show resolved
Hide resolved
...[projectId]/applications/[applicationId]/config-create-wizard/prompt-config-testing-form.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I would suggest extracting some of the code (especially rendering-related/JSX) into a standalone component.
Components shouldn't contain a lot of logic or state (similar to writing functions that follow the Single Responsibility Principle). This will help prevent bugs and quirks in the UI while making maintenance much easier.
Regarding useMemo and memo:
useMemo: Use it to cache "expensive" operations or derived state.
If it's possible to extract logic or expensive calculations into a util file, that's even better:
const [value, setValue] = useState();
const [filterTerm, setFilterTerm] = useState("");
const derivedState = useMemo(() => {
return someUtil(...params);
}, [value, filterTerm]);
// utils.ts
function someUtil(...args): K {
// logic
}
https://frontendmastery.com/posts/building-future-facing-frontend-architectures/
This PR updates the prompt config page by doing the following: