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

Conversation

Projects
None yet
2 participants
@edmundoa
Member

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 some commits Mar 22, 2016

Use global store and actions providers
Allow all stores in plugins and main application to hold the same state
Remove InjectStore and InjectActions
We don't need them any more, we can use Reflux.connect with the updated
StoreProvider.
Do not use ES6 requires on typescript files
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.
Fix field charts loading
Add missing imports, as now they are not required before the file is
required.
Load search information on pages with serch bar
Avoid issues with SearchStore initialization, as when the store is
required, the search parameters are not available.
Update dashboards on update and delete
The store is now always loaded, so we need to ensure that it has the
right dashboards when something changes.
Add jquery to vendor module
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

ci-server-integration Jenkins build graylog2-server-integration-pr 758 has succeeded
Details
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