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

Dynmic Config Change #49

Merged
merged 16 commits into from
Jun 16, 2023
Merged

Dynmic Config Change #49

merged 16 commits into from
Jun 16, 2023

Conversation

siyuniu-ms
Copy link
Contributor

@siyuniu-ms siyuniu-ms commented Jun 10, 2023

/

@siyuniu-ms siyuniu-ms marked this pull request as ready for review June 16, 2023 17:15
import { History, Location, Update } from "history";

import { IReactExtensionConfig } from './Interfaces/IReactExtensionConfig';
const defaultReactExtensionConfig: IConfigDefaults<IReactExtensionConfig> = objDeepFreeze({
blkVal: true,
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@siyuniu-ms siyuniu-ms merged commit 848eade into main Jun 16, 2023
7 checks passed
@siyuniu-ms siyuniu-ms deleted the siyu/dynamicChanges branch November 3, 2023 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants