mirror of
https://github.com/wassname/talk.git
synced 2026-07-18 12:40:13 +08:00
Document getSlotFragments
This commit is contained in:
@@ -41,7 +41,16 @@ function getComponentFragments(components) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {[key]: {spreads: string, definitions: AST}}
|
||||
* Returns an object that can be used to compose fragments or queries.
|
||||
*
|
||||
* Example:
|
||||
* const pluginFragments = getSlotsFragments(['commentInfoBar', 'commentDetail']);
|
||||
* const rootFragment = gql`
|
||||
* fragment Comment_root on RootQuery {
|
||||
+ ${pluginFragments.spreads('root')}
|
||||
* }
|
||||
* ${pluginFragments.definitions('root')}
|
||||
* `;
|
||||
*/
|
||||
export function getSlotsFragments(slots) {
|
||||
if (!Array.isArray(slots)) {
|
||||
|
||||
Reference in New Issue
Block a user