Active contexts are duplicated in some cases

Created on 1 April 2025, 17 days ago

Problem/Motivation

I have noticed that active contexts are sometimes duplicated. I'm primarily seeing this when using both the theme negotiator and block reactions together.

This causes the code in the reactions to be executed twice and in some cases elements on the page are duplicated.

Steps to reproduce

  • Create a context using the theme negotiator
  • Create a 2nd context with a block reaction.
  • Enable the context reaction debugger block
  • Visit a page.
  • you will see that the active contexts are duplicated.

Proposed resolution

I have a MR incoming

πŸ› Bug report
Status

Active

Version

5.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States loze Los Angeles

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @loze
  • Merge request !64Ensure contexts are only set once β†’ (Open) created by loze
  • πŸ‡ΊπŸ‡ΈUnited States loze Los Angeles

    Im not sure if this is the correct approach, but it does fix the problem for me.

    Im keying the activeContexts array by context id which makes sure any context is only set once.

  • πŸ‡ΊπŸ‡ΈUnited States loze Los Angeles

    I would have thought the $this->contextConditionsEvaluated variable takes care of this but apparently when both these reactions are used the value is somehow getting reset? I tried figuring that out but not sure whats going on there.

Production build 0.71.5 2024