-
Notifications
You must be signed in to change notification settings - Fork 53
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
Custom GraphQL and Mobility Profile Routing #1292
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes are working with multiple configs with and without mobility profile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall works, even if it's a bit hacky. Just want to double check a few things!
lib/main.js
Outdated
// Loads a JavaScript file which is set in the webpack section of the craco.config.js file. | ||
// This setting is defined from a custom environment setting passed into webpack or | ||
// defaults to ./config.js | ||
// defined in webpack config: | ||
// The JS_CONFIG variable is passed to this file by webpack's `DefinePlugin` that replaces the variable | ||
// with its content at compile time (like C's `#define` preprocessor directive). | ||
// eslint-disable-next-line no-undef | ||
const jsConfig = require(JS_CONFIG).configure(otpConfig) | ||
|
||
// Plug the plan query into the config (if available) | ||
otpConfig.api.planQuery = jsConfig.planQuery | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this? Why not just put it in the js config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This puts the custom query into the redux state, so it can be retrieved from actions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the comment in e60f694.
craco.config.js
Outdated
@@ -65,6 +67,13 @@ module.exports = { | |||
} | |||
addBeforeLoader(webpackConfig, loaderByName('file-loader'), yamlLoader) | |||
|
|||
// Support YAML |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment needs updating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated in 3726007
if (config.mobilityProfile) { | ||
baseQuery.mobilityProfile = loggedInUser?.mobilityProfile?.mobilityMode | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a GMAP specific branch for otp-rr? Do we want to bring this into dev?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet, although try to move specific stuff to config would be best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit nervous about this but it seems to work alright...
Description
This PR sets up craco to accept custom plan GraphQL files (or use a default one).
Custom plan query files are passed through the custom
config.js
and placed in the redux state at startup.For configuration-enabled mobility profiles, that new parameter is added to the variables passed to the GraphQL
plan
query.To test, ensure that planning trips with mobility profiles produce different results based on the profiles, and that on configs without mobility profiles, planning trips is not affected.
PR Checklist: