Skip to content

Commit 612de81

Browse files
committed
fix(microsoft_ad): clear non-owning filter and search on the merged inputs
The executor merges { ...inputs, ...transformedParams }, so declining to copy a stale filter is not enough — the serialized value survives the merge and still reaches the tool. Advanced-mode subBlocks are serialized on non-emptiness alone and never have their condition evaluated, so the value is present even when the field is hidden. Write filter and search on every operation, as undefined when the operation owns neither, so the merge clears them.
1 parent d19017d commit 612de81

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

apps/sim/blocks/blocks/microsoft_ad.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ const SHARED_FILTER_OPERATIONS = ['list_users', 'list_groups']
5252
* ownership rather than by letting later assignments overwrite earlier ones. Otherwise a clause
5353
* written for `/users` would still be sent when the block is switched to `/auditLogs/signIns` or
5454
* `/devices`, where it is invalid.
55+
*
56+
* The mapper must write `filter` and `search` on every operation, including as `undefined`. The
57+
* executor merges `{ ...inputs, ...transformedParams }`, so a key that is merely omitted here
58+
* leaves the stale serialized value in place rather than clearing it.
5559
*/
5660
const FILTER_FIELD_BY_OPERATION: Record<string, string> = {
5761
list_users: 'filter',
@@ -789,10 +793,8 @@ export const MicrosoftAdBlock: BlockConfig<MicrosoftAdResponse> = {
789793
if (params.top) result.top = Number(params.top)
790794
if (params.nextLink) result.nextLink = params.nextLink
791795
const values = params as Record<string, unknown>
792-
const filter = values[FILTER_FIELD_BY_OPERATION[params.operation]]
793-
if (filter) result.filter = filter
794-
const search = values[SEARCH_FIELD_BY_OPERATION[params.operation]]
795-
if (search) result.search = search
796+
result.filter = values[FILTER_FIELD_BY_OPERATION[params.operation]] || undefined
797+
result.search = values[SEARCH_FIELD_BY_OPERATION[params.operation]] || undefined
796798
if (params.operation === 'set_password') {
797799
result.forceChangePasswordNextSignIn = params.forceChangePasswordNextSignIn !== 'false'
798800
if (params.forceChangePasswordNextSignInWithMfa)

0 commit comments

Comments
 (0)