Budibase / budibase

Low code platform for building business apps and workflows in minutes. Supports PostgreSQL, MySQL, MariaDB, MSSQL, MongoDB, Rest API, Docker, K8s, and more 🚀
https://budibase.com
Other
21.88k stars 1.51k forks source link

[ Custom Components ] - Context propagation #14566

Closed poirazis closed 1 week ago

poirazis commented 1 week ago

When a custom component exposes Context ( local or global ) the context of the components placed inside doesnt get exposed.

How to replicate: Create a custom component that takes children and exposes some context ( anything will do ) Place a Data Provider inside it. Place a Paragraph outside it.

The Data Provider global context is not available to the Paragraph.

This used to work and recently changed. This has made a lot of my screens not working as my Super Container exposes context, and the context of the components placed inside it is no longer exposed upwards.

linear[bot] commented 1 week ago

BUDI-8641 [ Custom Components ] - Context propagation

aptkingston commented 1 week ago

I'll take a look, thanks for reporting @poirazis.

aptkingston commented 1 week ago

Is this only with custom components? I can't recreate this using built-in ones, so just wondering if should narrow my search to custom components only.

Just want to check as well - does your custom component expose any local context? If a component encounters any local context then this is intended behaviour, as we typically use local context to imply "branching", as in repeaters, where there will be multiple new context paths with different meanings but the same key. This assumption means that any global context inside any component that provides local context cannot escape.

I'm fairly certain this behaviour has not changed recently. Could you confirm if your custom component provides local context or not? If it does, can you try removing/changing that to global and seeing if you're now able to access global context from components inside?

poirazis commented 1 week ago

hey @aptkingston i think now i understand ! I will rewire my context accordingly I wasnt aware that any "local" would block nested "globals" but it makes perfect sense this way.

I changed my local context to global, and now works as before.

Thank you so much for your quick reply and solution. God Bless.