-
Notifications
You must be signed in to change notification settings - Fork 11
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
Dynmic Config Change #49
Conversation
import { History, Location, Update } from "history"; | ||
|
||
import { IReactExtensionConfig } from './Interfaces/IReactExtensionConfig'; | ||
const defaultReactExtensionConfig: IConfigDefaults<IReactExtensionConfig> = objDeepFreeze({ | ||
blkVal: true, |
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 exactly, this is defining a "property" called blkVal.
You need to either use the helper function of the "default" for the history need to contain the value
const defaultReactExtensionConfig: IConfigDefaults<IReactExtensionConfig> = objDeepFreeze({
history: { blkVal: true, v: undefined }
});
This is because the "value" of the default can either be the "value" you want to use as the default (for simple properties) or an IConfigDefaults
instance, which contains additional attributes to associate with the property (history
in this case) and any value assigned to this property.
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.
Just for double check. if user change history object, the prev_history would not equal to the current history, and the onConfigChange method would be called. If they change history.path, the prev_history.path would also not equal to current_history.path, but the onConfigChange would not be called.
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.
If they change history.path, the prev_history.path would also not equal to current_history.path, but the onConfigChange would not be called.
Correct, and that is fine, we are only adding hooks for when they change the "histroy" obejct that they are using.
During a SPA application (which react is used for) the path
value of the history
WILL (most often) change this code does not need (or want) to track this change (that is what the AnalyticsPlugin) is doing.
/