Skip to content

Commit

Permalink
CSF-tools: Optimize storySort handling
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman committed Jan 16, 2024
1 parent 46646bf commit a53c320
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions code/lib/csf-tools/src/getStorySortParameter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ const parseDefault = (defaultExpr: t.Expression, program: t.Program): t.Expressi
};

export const getStorySortParameter = (previewCode: string) => {
// don't even try to process the file
if (!previewCode.includes('storySort')) return undefined;

let storySort: t.Expression | undefined;
const ast = babelParse(previewCode);
traverse.default(ast, {
Expand Down

0 comments on commit a53c320

Please sign in to comment.