Skip to content

Block Entry Context: Update the settingsPropertyValueByAlias to observe settings.#20861

Merged
nielslyngsoe merged 1 commit intomainfrom
v17/bugfix/settingsPropertyValueByAlias-maps-to-undefined
Nov 17, 2025
Merged

Block Entry Context: Update the settingsPropertyValueByAlias to observe settings.#20861
nielslyngsoe merged 1 commit intomainfrom
v17/bugfix/settingsPropertyValueByAlias-maps-to-undefined

Conversation

@engijlr
Copy link
Contributor

@engijlr engijlr commented Nov 17, 2025

Fixed #19895

Problem

Calling settingsPropertyValueByAlias("alias") was always retrieving undefined. That was because the method was observing the #content instead of the #settings.

How to test(two ways)

  1. Create a custom UFM element
  2. Create a custom view(Using the Examples Project):
  • Run the examples project for block custom view
  • In the block-custom-view.js file, add the following code inside the constructor:
   this.consumeContext(UMB_BLOCK_ENTRY_CONTEXT, async (context) => {
       // Test observing a specific settings property by alias
       this.observe(
           await context?.settingsPropertyValueByAlias('yourSettingsPropertyAlias'),
           (value) => {
               console.log('Settings value by alias:', value);
           },
           'observeSettings'
       );
   });
  • Configure the block you want to use.
  • Go to content section and edit your block.
  • Open the console and you should see the value display

Note

You don't really need to observe through the context just to access settings data. The easier way is using property decorators directly:@property({ attribute: false }) settings?: UmbBlockDataType; This gets you straight to the settings without all the context setup.
An example here: Block Custom View docs.

That said, developers might still want to use the context-based approach with settingsPropertyValueByAlias() for different reasons, or it just makes more sense for what they're building. Either way, the API should do what it says. This fix ensures that if you decide to go down the context path, observing settings by alias will actually work properly.

@nielslyngsoe nielslyngsoe merged commit eae35a2 into main Nov 17, 2025
29 of 31 checks passed
@nielslyngsoe nielslyngsoe deleted the v17/bugfix/settingsPropertyValueByAlias-maps-to-undefined branch November 17, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Observing settingsPropertyValueByAlias("alias") maps to undefined

2 participants