Skip to content

Commit 8b3437e

Browse files
authored
Merge pull request #949 from jdnvn/main
fix sync behavior when remote expression value is set to nil
2 parents 45e334d + 0c8c8ff commit 8b3437e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/flipper/adapters/sync/feature_synchronizer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def call
5353
private
5454

5555
def sync_expression
56-
return if local_expression == remote_expression
56+
return if remote_expression.nil? || local_expression == remote_expression
5757

5858
@feature.enable_expression remote_expression
5959
end

spec/flipper/adapters/sync/feature_synchronizer_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@
105105
expect_no_enable_or_disable
106106
end
107107

108+
it "updates expression when remote is updated to nil" do
109+
remote = Flipper::GateValues.new(expression: nil)
110+
feature.enable_expression(plan_expression)
111+
adapter.reset
112+
113+
described_class.new(feature, feature.gate_values, remote).call
114+
115+
expect(feature.expression_value).to eq(nil)
116+
expect_only_disable
117+
end
118+
108119
it "adds remotely added actors" do
109120
remote = Flipper::GateValues.new(actors: Set["1", "2"])
110121
feature.enable_actor(Flipper::Actor.new("1"))

0 commit comments

Comments
 (0)