Skip to content

Commit 6f65e10

Browse files
committed
add default token field and check token
1 parent e64771f commit 6f65e10

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Flow.Launcher.Plugin/Interfaces/Feature.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
namespace Flow.Launcher.Plugin
77
{
8-
public interface IFeatures { }
8+
public interface IFeatures
9+
{
10+
}
911

1012
public interface IContextMenu : IFeatures
1113
{
@@ -33,6 +35,6 @@ public class ResultUpdatedEventArgs : EventArgs
3335
{
3436
public List<Result> Results;
3537
public Query Query;
36-
public CancellationToken Token { get; init; }
38+
public CancellationToken Token { get; init; } = default;
3739
}
38-
}
40+
}

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,13 @@ private void RegisterResultsUpdatedEvent()
135135
var plugin = (IResultUpdated)pair.Plugin;
136136
plugin.ResultsUpdated += (s, e) =>
137137
{
138-
if (e.Query.RawQuery == QueryText) // TODO: allow cancellation
138+
if (e.Query.RawQuery == QueryText && !e.Token.IsCancellationRequested)
139139
{
140140
PluginManager.UpdatePluginMetadata(e.Results, pair.Metadata, e.Query);
141-
if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(e.Results, pair.Metadata, e.Query, _updateToken)))
141+
if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(e.Results, pair.Metadata, e.Query, e.Token)))
142142
{
143143
Log.Error("MainViewModel", "Unable to add item to Result Update Queue");
144144
}
145-
;
146145
}
147146
};
148147
}

0 commit comments

Comments
 (0)