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

Use singleton store and actions providers #1967

Merged
merged 11 commits into from Mar 24, 2016
Merged

Conversation

@edmundoa
Copy link
Member

@edmundoa edmundoa commented Mar 23, 2016

These changes make StoreProvider and ActionsProvider global, so the web interface and all plugins share the same store instances. The reasons for this are:

  1. The state in a store is different for the web interface and plugins, as they have different instances. See issue #1965 for more information.
  2. Each plugin performs certain requests again, even if it doesn't need them, as it is again using a different store than the web interface. See #1966.

A consequence of these changes is that we don't need to pass StoreProvider and ActionsProvider in the React context, and InjectStore, and InjectActions are not needed any more either. Once a store or action is loaded with the provider, it can be used with Reflux as usual.

Sharing stores across all components in the web interface may lead to some inconsistencies in the data, as some stores only update data when a new instance is created. I fixed a couple of these problems in the SearchStore and DashboardsStore, but there may be more that I didn't see.

Another drawback of the changes is that live reloading is not available in stores any more. I guess for the beta this is reasonable enough, and we can try to find a better solution that supports live reloading in the future.

@edmundoa edmundoa added this to the 2.0.0 milestone Mar 23, 2016
@dennisoelkers dennisoelkers self-assigned this Mar 23, 2016
edmundoa added 11 commits Mar 22, 2016
Allow all stores in plugins and main application to hold the same state
We don't need them any more, we can use Reflux.connect with the updated
StoreProvider.
Using the StoreProvider to require typescript stores was returning a
module instead of the store itself. By switching to typescript exports,
this problem is solved.
Add missing imports, as now they are not required before the file is
required.
Avoid issues with SearchStore initialization, as when the store is
required, the search parameters are not available.
The store is now always loaded, so we need to ensure that it has the
right dashboards when something changes.
Fixes issues with events not being handled.
@edmundoa edmundoa force-pushed the singleton-store-provider branch from f948583 to 711d30b Mar 23, 2016
@dennisoelkers dennisoelkers merged commit c0846cf into master Mar 24, 2016
4 checks passed
4 checks passed
@garybot2
ci-server-integration Jenkins build graylog2-server-integration-pr 758 has succeeded
Details
@garybot2
ci-web-linter Jenkins build graylog-pr-linter-check 248 has succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@dennisoelkers dennisoelkers deleted the singleton-store-provider branch Mar 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants