Skip to content

Conversation

@gribnoysup
Copy link
Collaborator

@gribnoysup gribnoysup commented Nov 9, 2023

This patch introduces a service provider for data service, plugins using data service provider need to be in the connected application tree to function and can access it directly through activate plugin method.

As we already have a few plugins that were updated to the new interface that would benefit from using this service locator, I'm refactoring them to use new mechanism

  • import
  • export

To avoid blocking work, I'll follow up with the following plugins in a separate PR:

  • create view
  • create database
  • drop database
  • create collection
  • drop collection

@gribnoysup gribnoysup added the wip label Nov 9, 2023
describe('WorkspaceContent [Component]', function () {
let testAppRegistry: AppRegistry;
beforeEach(function () {
testAppRegistry = new AppRegistry();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@addaleax for now swithcing it back to global app registry in the useAppRegistryComponent and tests, the usage of those will be removed anyway pretty soon as the plugins we mock here are the next in line to be refactored.

Now that we have an app registry scope for a connected part application, we can't rely on global === local in this part of the app to ease testing

if (dataService === getState().dataService.dataService) {
dispatch(
globalAppRegistryEmit(
'export-finished',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This event was used in tests but nowhere else and tests could just wait for the dispatched action instead, so I removed it

ReturnType<typeof configureStore>['getState']
>;

export type ExportPluginServices = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something for later, but I'm starting to think we should probably have some helper types to get those types easier from the returned plugin object maybe? Similar to React.ComponentProps or something like that

@gribnoysup gribnoysup force-pushed the compass-7410-data-service-provider branch from 7928456 to b5b3c7a Compare November 9, 2023 11:37
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.

3 participants