NXT-15365: Replaced Gatsby with Astro Docs#272
Conversation
| the error boundary is triggered. Not perfect at all) | ||
| TODO: Add scripts for enact version selection here? Or, in docs? | ||
| This is a stand-alone sample runner that is intended to be embedded within an iframe. |
There was a problem hiding this comment.
check what happened here. i don;t see clear differences. is it line ending?
There was a problem hiding this comment.
Yes, it was changed from CLRF to LF
| import css from './Tooltip.module.css'; | ||
|
|
||
| const Tooltip = ({children, title, ...rest}) => { | ||
| const optionalStyle = title.includes('Optional'); |
There was a problem hiding this comment.
add a guard for falsey title
|
|
||
| return ( | ||
| <Tooltip | ||
| title={(title || linkTitle)?.split(/[.~]/).at(0)} |
There was a problem hiding this comment.
this evaluates to undefined when both are falsy. Fix: const optionalStyle = title?.includes('Optional') (or default title = '').
| */ | ||
| const getMembers = (data) => { | ||
| const members = data.members.static.map((member) => member); | ||
| const memberName = data.members.static[0].memberof.split('/').pop(); |
There was a problem hiding this comment.
we should have a guard in case data.members.static is empty
| const isComponent = member.tags.find((tag) => tag.title === 'ui'); | ||
| const isHoC = member.tags.find((tag) => tag.title === 'hoc'); |
There was a problem hiding this comment.
also need some guards
| returns: member.returns, | ||
|
|
||
| // Higher-Order Component Configuration | ||
| staticProperties: member.members.static[0]?.members.static || [], |
There was a problem hiding this comment.
add guard . member.members itself can be undefined
| import css from './MemberFunction.module.css'; | ||
|
|
||
| const MemberFunction = ({member, typeDefObjectFunction = false}) => { | ||
| const functionParams = member.params.map((value, index) => { |
There was a problem hiding this comment.
member.params.map -add guard for undefined
There was a problem hiding this comment.
I Recommend defaulting these ((member.params|| [])
| ) | ||
| }); | ||
|
|
||
| const functionReturns = member.returns.map((value) => { |
There was a problem hiding this comment.
member.returns.map -add guard for undefined
There was a problem hiding this comment.
I Recommend defaulting these ((member.returns|| [])
| } | ||
|
|
||
| const found = findGroupByPath(entry.entries, pathToMatch); | ||
| if (found) return Object.assign(found, {label: subfolder}); |
There was a problem hiding this comment.
Object.assign(found, {label: subfolder}); permanently renames a group inside the global sidebar. Prefer to return {...found, label: subfolder}
| } else if (isDeveloperGuidePage) { | ||
| sublist = filterSidebarEntries(sidebar, 'Developer Guide'); | ||
|
|
||
| const parts = id.split('/').filter(Boolean).filter((id) => id !== 'docs'); |
There was a problem hiding this comment.
the Developer Guide branch strips 'docs' from the path parts before computing isSubfolder; the Developer Tools branch doesn't. And filterSidebarBySubfolder re-splits the raw id regardless. If the two sections share a docs/… id shape, the subfolder depth check is off-by-one between them. Normalize both branches.
| fast = args.fast, | ||
| enactCmd = args['enact-cmd'] || 'enact'; | ||
|
|
||
| if (!enactCmd && !shell.which('enact')) { |
There was a problem hiding this comment.
enactCmd = args['enact-cmd'] || 'enact' is always truthy, so if (!enactCmd && !shell.which('enact')) can never fire;
the "requires the enact cli" check is dead and won't warn when enact is missing.
Use if (!args['enact-cmd'] && !shell.which('enact'))
| if (!reference) return; | ||
| if (!title) linkTitle = reference; | ||
|
|
||
| const isExternal = reference.includes('http'); |
There was a problem hiding this comment.
This treats any reference containing the substring "http" anywhere as external and returns it verbatim.
The see-link branch (line 38) already uses the correct startsWith('http://'|'https://') check
| )} | ||
| <dd className={css.functionDetails + ' ' + noParamsClassName + ' ' + noReturnsClassName}> | ||
| <div className={css.paramsContainer}> | ||
| <h6 className={css.header + ' ' + css.params}>{paramsNumber} Param{paramsNumber > 1 && 's'}</h6> |
There was a problem hiding this comment.
can we use !== 1 instead of >1 ?
|
|
||
| const Code = ({children}) => { | ||
| if (typeof children === 'string') { | ||
| hljs.registerLanguage('javascript', javascript); |
There was a problem hiding this comment.
can we hoist this to the module top level?
Checklist
Issue Resolved / Feature Added
Replaced
GatsbywithAstro DocsResolution
Additional Considerations
Until merge into
develop, there will be some broken links inEdit on GitHubbecause it was set to refers ondocs developbranch.Links
NXT-15365
Comments
Enact-DCO-1.0-Signed-off-by: Ion Andrusciac ion.andrusciac@lgepartner.com