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

Upgrade and adapt to new version of libraries in ogre-tools #7241

Merged
merged 3 commits into from Feb 27, 2023

Conversation

jansav
Copy link
Contributor

@jansav jansav commented Feb 27, 2023

This version brings back requirement for exact reference for injection tokens and injectables. It also allows future Features not have conflicting IDs for injectables automatically.

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
@jansav jansav added the chore label Feb 27, 2023
@jansav jansav added this to the 6.5.0 milestone Feb 27, 2023
@jansav jansav requested a review from a team as a code owner February 27, 2023 08:07
@jansav jansav requested review from Iku-turso and ixrock and removed request for a team February 27, 2023 08:07
@@ -262,6 +272,11 @@ describe("cluster-store", () => {

describe("pre 3.6.0-beta.1 config with an existing cluster", () => {
beforeEach(() => {
di.override(storeMigrationVersionInjectable, () => "3.6.0");
Copy link
Contributor Author

@jansav jansav Feb 27, 2023

Choose a reason for hiding this comment

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

override has to happen before inject.

Comment on lines 93 to +95
di.override(storeMigrationVersionInjectable, () => "10.0.0");

userStore = di.inject(userStoreInjectable);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

override has to happen before inject

@@ -43,7 +43,7 @@ describe("ApiManager", () => {
di.override(directoryForKubeConfigsInjectable, () => "/some-kube-configs");
di.override(storesAndApisCanBeCreatedInjectable, () => true);

const createCluster = di.inject(createClusterInjectable);
const createCluster = di.inject(createClusterInjectionToken);
Copy link
Contributor Author

@jansav jansav Feb 27, 2023

Choose a reason for hiding this comment

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

Reference equality is important here. Previously it worked because the implementation for createClusterInjectionToken in main and renderer had same ID.

Comment on lines +205 to 226
const someChannelListenerInjectable = getInjectable({
id: "some-channel-listener",

instantiate: () => ({
channel: testRequestChannel,
handler: () => () => "irrelevant",
}),

injectionToken: requestChannelListenerInjectionToken,
});

testChannelListenerInMain2Injectable.id += "2";
const someOtherChannelListenerInjectable = getInjectable({
id: "some-other-channel-listener",

instantiate: () => ({
channel: testRequestChannel,
handler: () => () => "irrelevant",
}),

injectionToken: requestChannelListenerInjectionToken,
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mutating injectable ID is not possible and shouldn't be advertised.

Comment on lines +28 to +38
builder.beforeWindowStart((windowDi) => {
// TODO: remove once ClusterStore can be used without overriding it
windowDi.override(getClusterByIdInjectable, () => (clusterId) => {
if (clusterId === cluster.id) {
return cluster;
}

return undefined;
});
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

override has to happen before inject

@@ -830,7 +830,40 @@ exports[`Showing correct entity settings when navigating to non-local cluster en
>
Proxy
</h2>
<section />
<section>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Notice that previously the snapshot was providing wrong output.

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
@jansav jansav changed the title Update and adapt to new version of libraries in ogre-tools Upgrade and adapt to new version of libraries in ogre-tools Feb 27, 2023
@Nokel81 Nokel81 merged commit 003dc44 into master Feb 27, 2023
@Nokel81 Nokel81 deleted the chore/injectable-bump branch February 27, 2023 19:27
@Nokel81 Nokel81 mentioned this pull request Mar 13, 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

2 participants