Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scully): replace falsy check with explicit string check to allow root route #276

Merged
merged 1 commit into from
Feb 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scully/utils/defaultAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const generateAll = async (localBaseFilter = baseFilter) => {
performanceIds.add('Discovery');
log('Pull in data to create additional routes.');
const handledRoutes = await addOptionalRoutes(
unhandledRoutes.filter((r: string) => r && r.startsWith(localBaseFilter))
unhandledRoutes.filter((r: string) => typeof r === 'string' && r.startsWith(localBaseFilter))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still not sure if this check is needed at all. Maybe it makes sense to just omit it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It protects to mistakes in the Scully.config file. so, yes the check is needed. We have no control over the data that is coming from the guess parser, and neither on the config file. If a route is not a string, its pretty safe to ignore it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, thank you.

);
performance.mark('stopDiscovery');
/** save routerinfo, so its available during rendering */
Expand Down