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

Add callback to force refresh comments #49

Merged
merged 3 commits into from
Aug 21, 2017
Merged

Conversation

c3dr0x
Copy link
Contributor

@c3dr0x c3dr0x commented Aug 10, 2017

Fix issue #48

Solution

Add two props registerRefreshCommentsMethod and unregisterRefreshCommentsMethod.
They are used to register a method into a parent component to force refresh of components.

Usage

Can be used like followed :

    _refreshComments: undefined,

    registerRefreshCommentsMethod(method) {
        this._refreshComments = method;
    },

    unregisterRefreshCommentsMethod() {
        this._refreshComments = undefined;
    },

    refreshComments() {
        if (this._refreshComments) {
            this._refreshComments();
        }
    },

    [...]

    <FocusComments 
        {...props}
        registerRefreshCommentsMethod={this.registerRefreshCommentsMethod}
        unregisterRefreshCommentsMethod={this.unregisterRefreshCommentsMethod}
    />

@c3dr0x c3dr0x self-assigned this Aug 10, 2017
@c3dr0x c3dr0x requested a review from Hartorn August 10, 2017 09:19
@c3dr0x c3dr0x changed the title [Enhancement] Add callback to force refresh of comments [Enhancement] Add callback to force refresh comments Aug 10, 2017
@c3dr0x c3dr0x changed the title [Enhancement] Add callback to force refresh comments Add callback to force refresh comments Aug 10, 2017
@c3dr0x c3dr0x force-pushed the feature-external-refresh branch from d66dbcd to f54c960 Compare August 21, 2017 08:46
@c3dr0x c3dr0x merged commit d833cc9 into develop Aug 21, 2017
@c3dr0x c3dr0x deleted the feature-external-refresh branch August 21, 2017 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants