You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I attempted to create a new indexer with the RegExp match \.amlstories.ts$?\ and couldn't understand why it was not working. It took quite some debugging and referencing existing indexers to realise that the indexer array is first-come, first-served for the regex match. After changing the RegExp to \.aml.ts%?\, the indexer matched the file type and ran normally.
I see two solutions - the easiest is to simply document this fact. It shouldn't be hard to keep story or stories out of the matched filename, though instinct does indicate that you write that. Alternatively, a combinatorial approach would allow you to have a different render for each indexer, and combine them together. I don't mind, I just wanted this to be documented for anyone else who hits this (admittedly trivial) issue in the future :)
Add a custom_indexer with the test matching the same as the default indexer (i.e. anything ending story or stories).
I expected the indexer to be 'added' or 'merged' with the existing one, so that regular stories would be indexed, as well as new ones. Instead, the existing indexer was ran, and the new indexer wasn't even triggered (Which led to a lot of head scratching to figure out why the test was failing - it wasn't, strictly speaking, it was just never ran as the first indexer to satisfy the result was used).
Describe the bug
I attempted to create a new indexer with the RegExp match
\.amlstories.ts$?\
and couldn't understand why it was not working. It took quite some debugging and referencing existing indexers to realise that the indexer array is first-come, first-served for the regex match. After changing the RegExp to\.aml.ts%?\
, the indexer matched the file type and ran normally.I see two solutions - the easiest is to simply document this fact. It shouldn't be hard to keep
story
orstories
out of the matched filename, though instinct does indicate that you write that. Alternatively, a combinatorial approach would allow you to have a different render for each indexer, and combine them together. I don't mind, I just wanted this to be documented for anyone else who hits this (admittedly trivial) issue in the future :)Reproduction link
https://stackblitz.com/~/github.com/LazerFX/storybook-indexer-bug
Reproduction steps
custom_indexer
with thetest
matching the same as the default indexer (i.e. anything ending story or stories).I expected the indexer to be 'added' or 'merged' with the existing one, so that regular stories would be indexed, as well as new ones. Instead, the existing indexer was ran, and the new indexer wasn't even triggered (Which led to a lot of head scratching to figure out why the test was failing - it wasn't, strictly speaking, it was just never ran as the first indexer to satisfy the result was used).
System
Additional context
No response
The text was updated successfully, but these errors were encountered: