Conversation
bobular
left a comment
There was a problem hiding this comment.
Hi @aurreco-uga - I figured out the problem and solution but got Claude to do the typing below.
Problem
The error messages in the AlphaFold section are rendering outside the CollapsibleSection component. Looking at the screenshot provided, the pink error message appears as a standalone element rather than being contained within the expandable/collapsible "AlphaFold" section.
Current Behavior
The code has several early returns that render error states:
- No data URL (lines 81-92)
- Loading state (lines 95-106)
- Invalid/404 URL (lines 109-145)
These all return plain <div> elements that are not wrapped in the CollapsibleSection structure. Only when dataUrlStatus === 'valid' does it render <BlockRecordAttributeSection {...props} />, which provides the proper collapsible section wrapper.
Additional Issue
The error messages may be rendering regardless of whether the section is collapsed or expanded. The error states should only be visible when the section is open.
Proposed Solution
Create a wrapper component within the same file that mimics what BlockRecordAttributeSection does - it should:
- Set up the
CollapsibleSectionstructure - Accept
childrenas a prop to render custom content inside the section - Respect the
props.isCollapsedstate
Example Implementation
// Add this wrapper component in AlphaFoldAttributeSection.tsx
function AlphaFoldErrorWrapper({
children,
attribute: { name, displayName, help },
isCollapsed,
onCollapsedChange,
title
}: Props & { children: React.ReactNode }) {
const headerContent = title ?? (
<DefaultSectionTitle displayName={displayName} help={help} />
);
return (
<CollapsibleSection
id={name}
className="wdk-RecordAttributeSection"
headerContent={headerContent}
isCollapsed={isCollapsed}
onCollapsedChange={onCollapsedChange}
>
<div className="wdk-RecordAttributeSectionContent">
{children}
</div>
</CollapsibleSection>
);
}Note: You'll need to import CollapsibleSection and DefaultSectionTitle from the appropriate WDK locations.
Then Update the Early Returns
Replace the plain <div> returns with the wrapper:
// No data URL case (lines 81-92)
if (!hasDataUrl) {
return (
<AlphaFoldErrorWrapper {...props}>
<div className="wdk-RecordAttributeSectionItem" style={{ padding: '1em' }}>
<p>
<em>AlphaFold structure prediction not available for this gene.</em>
</p>
</div>
</AlphaFoldErrorWrapper>
);
}
// + do similar for:
// Loading state (lines 95-106)
// Invalid URL case (lines 109-145)Benefits
- Consistent UI: All states (error, loading, valid) appear within the same collapsible section structure
- Proper Collapsing: Error messages will only be visible when the section is expanded
- Cleaner Code: Reuses the existing section wrapper pattern
- Better UX: Users see the AlphaFold section header and can choose to expand/collapse it, regardless of the content state
Next Steps
- Examine
BlockRecordAttributeSectionimplementation to determine the exactCollapsibleSectionimports and props needed - Implement the
AlphaFoldErrorWrappercomponent - Update all early return statements to use the wrapper
- Test that the section collapses/expands properly in all states
- Include testing of expand/collapse from left-hand navigation panel
|
btw I did consider alternative solutions. We could have enhanced |
|
omar approved the current proposal, UI wise.. how about merging it into the patch branch and we work on your proposal for main? i could see other sections with similar issues and it would be good to handle all the same... |
|
I'd need to test it on a dev site first. Do you have one? It wasn't simple for me to put up a local dev server or a dev site due to the yarn3/yarn4 divergence. |
|
i have my implement on https://aurreco.plasmodb.org/plasmo.aurreco/app/record/gene/PfDd2_130048800 or are you meaning to test your proposal on a master site? i thought we could do that later |
|
Thanks. I don't like the way it breaks the page mechanics. Once the section has been expanded there is no way to hide the warning message by collapsing it again. Even via the left-hand nav menu. I prefer to implement* my suggestion (I can do it if you prefer) and then re-implement something more general later when we have identified the wider need. ETA: * and cherry pick into |
|
Hi @aurreco-uga - I demoed and discussed with Steve in scrum and we're fine with this being merged as-is to the legacy branch(es). If we need to revisit this on the feature site/ |
* alphafold--first-test-url * request to show message within collapsible section (cherry picked from commit d0f3b3a)
| // Handle missing data URL | ||
| if (!hasDataUrl) { | ||
| return ( | ||
| <div |
There was a problem hiding this comment.
Just wondering why you didn't wrap this (and the next "early return" a few lines down) in the AlphaFoldErrorWrapper?
|
we havent seen instances of those.. probably i was in a hurry and focused on what was needed.. |
Sure - no worries! |

No description provided.