Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return routeMatches.map((match, i) => {
const { route } = match;
const Component = Components[i];
const queryConfig = queryConfigs[i];
const readyState = readyStates[i];
const extraData = routeExtraData[i];
const isComponentResolved = isResolved(Component);
// Handle non-Relay routes.
if (!queryConfig) {
if (route.prerender) {
route.prerender({ ...readyState, match, extraData });
}
if (route.render) {
return route.render({
match,
Component: isComponentResolved ? Component : null,
props: match,
});
}
if (!isComponentResolved) {
return routeMatches.map((match, i) => {
const { route, router } = match;
const Component = Components[i];
const querySubscription = querySubscriptions[i];
const isComponentResolved = isResolved(Component);
// Handle non-Relay routes.
if (!querySubscription) {
if (route.render) {
return route.render({
match,
Component: isComponentResolved ? Component : null,
props: match,
});
}
if (!isComponentResolved) {
return undefined;
}
return Component ? : null;
return routeMatches.map((match, i) => {
const { route } = match;
const Component = Components[i];
const queryConfig = queryConfigs[i];
const readyState = readyStates[i];
const extraQuery = extraQueries[i];
const extraData = this.getExtraData(extraQuery, readyState);
const isComponentResolved = isResolved(Component);
// Handle non-Relay routes.
if (!queryConfig) {
if (route.prerender) {
route.prerender({ ...readyState, match, extraData });
}
if (route.render) {
return route.render({
match,
Component: isComponentResolved ? Component : null,
props: match,
});
}
if (!isComponentResolved) {
return earlyComponents.map((Component, i) => {
const queryConfig = queryConfigs[i];
const extraQuery = extraQueries[i];
if (!queryConfig && !extraQuery) {
return null;
}
if (!isResolved(Component)) {
return PENDING_READY_STATE;
}
// TODO: What about deferred queries?
// We use checkRelayQueryData here because I want to batch all the Relay
// requests. We can send out requests for resolved components, but that
// runs the risk of the data we request now being out-of-sync with the
// data we request later.
if (queryConfig) {
const querySet = Relay.getQueries(Component, queryConfig);
const hasQueryData = Object.values(querySet).every(
query => !query || checkRelayQueryData(recordStore, query),
);
if (!hasQueryData) {
return PENDING_READY_STATE;