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

Remove BaseStore<T> and replace with composition of dependencies #7002

Merged
merged 34 commits into from
Mar 28, 2023

Conversation

Nokel81
Copy link
Collaborator

@Nokel81 Nokel81 commented Jan 24, 2023

Signed-off-by: Sebastian Malton sebastian@malton.name

@Nokel81 Nokel81 added the chore label Jan 24, 2023
@Nokel81 Nokel81 added this to the 6.4.0 milestone Jan 24, 2023
@Nokel81 Nokel81 requested a review from a team as a code owner January 24, 2023 15:41
@Nokel81 Nokel81 requested review from ixrock and aleksfront and removed request for a team January 24, 2023 15:41
@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@Nokel81 Nokel81 modified the milestones: 6.4.0, 6.5.0 Jan 26, 2023
@Nokel81 Nokel81 changed the title Convert BaseStore<T> away from abstract class to simplify dependency structure Convert BaseStore<T> away from abstract class to simplify dependency structure Jan 27, 2023
@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

ixrock
ixrock previously approved these changes Jan 27, 2023
Copy link
Member

@ixrock ixrock left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 47 to 49
runInAction(() => {
this.preferences.set(entityId, merge(this.preferences.get(entityId), preferences));
});
Copy link
Member

@ixrock ixrock Jan 27, 2023

Choose a reason for hiding this comment

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

Why do we need to "run in action" that single observable's update? or updating any map/set or single in general observable unit. Afaik runInAction needs to optimize update something/optimize reactions/etc? and do it in single "transaction" when updates multiple observables within single function scope, e.g.

// that would make sense for me for example
runInAction(() => {
      this.preferences.set(entityId, merge(this.preferences.get(entityId), preferences));
      this.somethingObservableToo = "UPDATED!";
    });

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes runInAction is a way to specify a transaction. The reason why updating a single observable doesn't normally need to also be within an action is because we currently have enforceActions: false as part of our mobx configuration.

@@ -246,7 +246,7 @@ export class ClusterManager {

protected onNetworkOnline = () => {
this.dependencies.logger.info(`${logPrefix} network is online`);
this.dependencies.store.clustersList.forEach((cluster) => {
this.dependencies.store.clustersList.get().forEach((cluster) => {
Copy link
Member

Choose a reason for hiding this comment

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

nit: why not? 🤪
anyway.. i don't think there is a big need to convert normal observable fields to computed values on the way (too much).

Suggested change
this.dependencies.store.clustersList.get().forEach((cluster) => {
this.dependencies.get().store.get().clustersList.get().forEach((cluster) => {

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2023

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2023

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
- To fix type errors

Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
- Ubuntu CI seems to format arrays in snapshots differently than macOS locally

Signed-off-by: Sebastian Malton <sebastian@malton.name>
@Nokel81 Nokel81 changed the title Convert BaseStore<T> away from abstract class to simplify dependency structure Remove BaseStore<T> and replace with composition of dependencies Mar 28, 2023
Copy link
Contributor

@Iku-turso Iku-turso left a comment

Choose a reason for hiding this comment

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

Live-reviewed

@Iku-turso Iku-turso merged commit 49f0a1a into master Mar 28, 2023
@Iku-turso Iku-turso deleted the base-store-composition branch March 28, 2023 14:54
@Nokel81 Nokel81 mentioned this pull request Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants