Skip to content

TreeView: boolean fallback should use ?? instead of || #759

@MrSentex

Description

@MrSentex

Summary

Boolean fallback values in TreeView use || false instead of nullish coalescing, which can lead to incorrect behavior for configuration options.

Steps to Reproduce

const foo = new HSTreeView(element, {
    isIndeterminate: false,
});

console.log(foo.isIndeterminate);

Source:

this.isIndeterminate = concatOptions?.isIndeterminate || true;

Demo Link

https://stackblitz.com/edit/preline-4-1-3-react-vite

Expected Behavior

The fallback should only apply when the value is null or undefined.

Actual Behavior

|| checks for truthiness instead of existence, so falsy values are treated as missing values.

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions