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

fix: Revert "fix: Reconciliation bug" #117

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Sources/Confidence/Confidence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public class Confidence: ConfidenceEventSender {
var map = confidence.contextFlow.value
for removedKey in removeKeys {
map.removeValue(forKey: removedKey)
confidence.removedContextKeys.insert(removedKey)
Copy link
Member Author

Choose a reason for hiding this comment

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

This function is only called from the Provider and we don't want the diffed OF keys to be removed from this Confidence descendants

}
for entry in context {
map.updateValue(entry.value, forKey: entry.key)
Expand Down
4 changes: 0 additions & 4 deletions Sources/Confidence/Contextual.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ public protocol Contextual: ConfidenceContextProvider {
*/
func removeKey(key: String)
/**
Perform `putContext` and multiple `removeKey` at once
*/
func putContext(context: ConfidenceStruct, removeKeys: [String])
/**
Creates a child Contextual instance that maintains access to its parent's data
*/
func withContext(_ context: ConfidenceStruct) -> Self
Expand Down
23 changes: 0 additions & 23 deletions Tests/ConfidenceTests/ConfidenceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,6 @@ final class ConfidenceTests: XCTestCase {
XCTAssertEqual(confidenceChild.getContext(), expected)
}

func testWithContextUpdateParentRemoveKeys() {
let confidenceParent = Confidence.init(
clientSecret: "",
region: .europe,
eventSenderEngine: EventSenderEngineMock(),
initializationStrategy: .activateAndFetchAsync,
context: ["k1": ConfidenceValue(string: "v1")],
parent: nil
)
let confidenceChild: ConfidenceEventSender = confidenceParent.withContext(
["k2": ConfidenceValue(string: "v2")]
)
confidenceChild.putContext(
context: ["k3": ConfidenceValue(string: "v3")],
removeKeys: ["k1"]
)
let expected = [
"k2": ConfidenceValue(string: "v2"),
"k3": ConfidenceValue(string: "v3"),
]
XCTAssertEqual(confidenceChild.getContext(), expected)
}

func testUpdateLocalContext() {
let confidence = Confidence.init(
clientSecret: "",
Expand Down
Loading