MCPcopy Index your code
hub / github.com/chartbrew/chartbrew / _onAddFilter

Function _onAddFilter

client/src/containers/EmbeddedChart.jsx:154–184  ·  view source on GitHub ↗
(condition)

Source from the content-addressed store, hash-verified

152 };
153
154 const _onAddFilter = async (condition) => {
155 let found = false;
156 const newConditions = conditions.map((c) => {
157 let newCondition = c;
158 if (c.id === condition.id) {
159 newCondition = condition;
160 found = true;
161 }
162 return newCondition;
163 });
164 if (!found) newConditions.push(condition);
165 setConditions(newConditions);
166
167 setDataLoading(true);
168 await dispatch(runQueryWithFilters({
169 project_id: chart.project_id,
170 chart_id: chart.id,
171 filters: newConditions,
172 shareToken: searchParams.get("token"),
173 }))
174 .then((data) => {
175 if (data.payload) {
176 setChart(data.payload);
177 }
178
179 setDataLoading(false);
180 })
181 .catch(() => {
182 setDataLoading(false);
183 });
184 };
185
186 const _onClearFilter = (condition) => {
187 const newConditions = [...conditions];

Callers

nothing calls this directly

Calls 3

runQueryWithFiltersFunction · 0.90
dispatchFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected