镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

if binding evaluating to false delays invocation of koDescendantsComplete #414

Open

Description

@brimimc

Migrating from knockout, I have component templates that have simple if binding checks like

<!-- ko if: showTabsList -->

if showTabsList is set to false, and we have a koDescendantsComplete() function, that function is never called. Only when showTabsList is set to true will koDescendantsComplete be called.

This appears to be similar behavior to knockout's completeOn: "render" option, but that's not what we want/need.

Is there any way to have koDescendantsComplete even when an if binding is bound to false?

Activity

  1. brimimc commented on Jul 8, 2026

    @brimimc
    Author

    This may be fixed in latest - will need to get a release to test with

  2. brimimc commented on Jul 16, 2026

    @brimimc
    Author

    Of note - we've found that the descendantsComplete binding handler applies TOO EARLY (before a child foreach has updated the DOM) - I'm not sure if the comment on the fix "Fix mirrors DescendantBindingHandler" if that will also be too early.

    @phillipc any ideas when the next release will happen for me to test the updates? thanks

  3. phillipc commented on Jul 16, 2026

    @phillipc
    Member

    Hey @brimimc, i think the DescendantsComplete-behavior is different in TKO.

    Properly you can switch to childrenComplete: render, see here:

    it('TKO-Change: descendantsComplete callback function is not called after nested "if" binding', function () {

    BTW: Have you already set the option createChildContextWithAs to false for your migration project (see #191)?

  4. brimimc commented on Jul 17, 2026

    @brimimc
    Author

    Interesting @phillipc ... switching from descendantsComplete to childrenComplete could work for a single sub-component, but we have multiple and we need to wait for all of them to have childrenComplete before invoking our logic.

    And yes we do have ko.options.createChildContextWithAs = true; set.

    Any update on when the next release with koDescendantsComplete behavior fixes might be released?

  5. phillipc commented on Jul 18, 2026

    @phillipc
    Member

    I couldn't stop thinking about this either. I've implemented a solution that restores the KO behavior.

    @brianmhunt , please take a look at this. -> #416

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions