Support block label#12
Conversation
Summary of ChangesHello @mzueva, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new feature to support configurable block labels, providing more descriptive and dynamic titles for application blocks. It includes necessary model changes to define these labels, UI logic for their initialization and dynamic display, and a refactoring of internal output handling. Additionally, a significant number of project dependencies have been updated to their latest versions, ensuring the application remains current with its underlying libraries. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for a customizable block label, which is displayed as a subtitle. The implementation adds defaultBlockLabel and customBlockLabel to the block arguments and uses them to generate the subtitle. The logic for updating the default label based on the selected dataset is correctly implemented. However, it is currently placed within a page-specific component, which could lead to inconsistent UI behavior when navigating between different pages of the block. I have provided a recommendation to move this logic to a global application scope to ensure consistency. Other changes, such as dependency updates and API adaptations, appear to be in order.
| watchEffect(() => { | ||
| const inputRef = app.model.args.inputAnchor; | ||
| if (inputRef) { | ||
| app.model.args.defaultBlockLabel = app.model.outputs.inputOptions?.find((o) => plRefsEqual(o.ref, inputRef))?.label ?? ''; | ||
| } else { | ||
| app.model.args.defaultBlockLabel = 'Select dataset'; | ||
| } | ||
| }); |
There was a problem hiding this comment.
This watchEffect is page-specific, which means the block's subtitle will not update correctly if the user changes the dataset while on a different page (e.g., 'By Sample'). This logic should be moved to a central location like ui/src/app.ts to ensure it applies globally across the entire block. This will fix the bug and improve maintainability by keeping all global state logic in one place.
Please remove this watchEffect from here and add the following logic inside the defineApp callback in ui/src/app.ts:
// in ui/src/app.ts
// You'll need to add this import at the top of the file:
// import { plRefsEqual } from '@platforma-sdk/model';
watch(() => [app.model.args.inputAnchor, app.model.outputs.inputOptions] as const, ([inputAnchor, inputOptions]) => {
if (inputAnchor) {
app.model.args.defaultBlockLabel = inputOptions?.find(({ ref }) => plRefsEqual(ref, inputAnchor))?.label ?? '';
} else {
app.model.args.defaultBlockLabel = 'Select dataset';
}
});There was a problem hiding this comment.
agree, should be fixed
There was a problem hiding this comment.
@kevindetry-milaboratories What do you think? We we following general approach from example block "clonotype-clustering", where this logic was implemented on the Main page. Does it make sense to change it as general approach?
Support block label