Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependant rows are not hidden if the row they depends are hidden #2171

Open
rohita-personatech opened this issue Aug 5, 2021 · 4 comments
Open

Comments

@rohita-personatech
Copy link

I have a use case where lets say there are 3 rows, A, B and C

  1. Row A is (String)
  2. Row B (Bool) depends on A
  3. Row C depends on B

When i changed the value in row A which then hides the row B, but as Row C depends on B it should also hide.
As Row B is not visible.

Please help me to fix this.

  • Environment: Eureka - latest
  • Xcode - 12.5
  • iOS : 13 version
@mats-claassen
Copy link
Member

One option would be to declare Row C dependent on Row A and in the condition (if you use a function condition) check whether Row B is hidden. Or just replicate the logic to make row C also depend on row A which is not so elegant but will be consistent.

@rohita-personatech
Copy link
Author

One option would be to declare Row C dependent on Row A and in the condition (if you use a function condition) check whether Row B is hidden. Or just replicate the logic to make row C also depend on row A which is not so elegant but will be consistent.

@mats-claassen Thanks for the reply. As i wanted to implement the dynamic forms C is not aware about the dependancy with A.
Is there any way I can achieve this without adding dependancy on A?

@mats-claassen
Copy link
Member

I understand. So Eureka currently does not support transitive dependencies and it also only supports "observing" the value of another row. Having said that, if you use the Condition.function type to calculate whether a row should be hidden or not, you can check whether the other row is hidden or disabled, etc.

So when Row A's value changes, evaluateHidden gets called only for rows directly dependent on it. I see 2 ways forward for you in this case:

  • You modify your dependency graph to add explicit dependencies to each row (possibly duplicating logic)
  • You implement this feature in Eureka (PRs welcome). I would follow a path like this:
    • When the hidden value of a row changes, you call evaluateHidden on each of the rows that depend on this row. (See here). This could be implemented in a didSet of hiddenCache (See here)
    • In the condition you define for each row (to see if it should be hidden), you also check whether the other row is hidden, apart from its value.
    • I would put this feature behind a feature flag to enable/disable it

@rohita-personatech
Copy link
Author

thnaks, will try to implement this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants