Dependancy app tables do not update

In my app I am using a dependancy.
This dependancy is a UI component but has its own tables.
When adding the dependancy, these tables are forcibly added to my app’s tables.
I’d actually like to aviod that. That data should remain encapsulated into the dependancy component, who is the one and the only to use them in order to render its UI. If I ever need to access them, I’d set up some methods on the component to do that.

So I though that was just “a view” over the tables of the dependancy component.
I expected that changing the data in the dependancy tables, the main app would show the updated data in the dependancy-created table.
But this does not happen.
Is that by design?
Is there a way to sync those tables?

Thanks and BR

I found the answer in this reply by Shaun.
So, what I understand is this: when I add to APP A a dependency to APP B, if APP B has tables, the IDE creates in APP A a copy of APP B’s tables.
If I want to use the tables of APP B, I need to import that ad explicitly.

That is currently possible only in “Classic IDE” so, if you’re using “Beta IDE” you need to:
-switch to Classic IDE
-go to Tables service
-add Table → choose from available APPs the APP B and the table(s) you need
-switch to Beta IDE.

I think in the future it could be useful one of these two:

  1. a setting in APP B to state that APP will use only its own tables (to enforce somewhat encapsulation). In this case, using this APP as a dependency won’t trigger
  2. a flag in APP A, where you set the dependency on APP B, to say “Use dependency’s data tables”. When checked, no APP B’s tables are added to APP A.

BR

If I remember correctly, if:

  • app A has TableA
  • app B has TableB
  • app A depends from app B

→ you get a failure when app B tries to access TableB, which doesn’t exist in app A.

If I remember, app B fails when trying to use tables.table_b.
The solution is to either create a new TableB or share any existing table with the required columns and call it table_b.

This allows you to create a dependency that can either work with its own table (but you need to explicitly share it on the parent app) or that manages any table on any app (as long as the table has the expected name and columns)

2 Likes

Hi @stefano.menci yes it is as you said.

Now the question is: how was Table B created inside App A.

I thought the IDE had created it automatically when I declared the dependency, but that reveals to be false at a simple test I just made.
For sure I didn’t re-create it from scratch. (It’s full of non trivial values).
And it looks like I didn’t add it from App B (through Classic IDE) because the two Table Bs (the one in App A and the original one in App B) are completely separated. If I delete/modify/add one data here, that doesn’t reflect there.
I think I’ll just stick a “supernatural” label to this question and live happily without finding out. :smiley:

However, back to the final requests of my previous post, the reason is this: when you design a non-trivial custom component, some tables may be required for its internal working.
When you use it, it would be cleaner to hide this internal data to the external App.
Now, while Anvil has means to let the component use its internal data (that is: add its tables in the including App), there are no means of hiding that internal data to the external app.
My 2 cents.

BR