Skip to content

Conversation

@imodeljs-admin
Copy link
Collaborator

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to next, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

next is currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, run changeset pre exit on next.

⚠️⚠️⚠️⚠️⚠️⚠️

Releases

@itwin/presentation-hierarchies@2.0.0-alpha.11

Major Changes

  • #1198: Change HierarchyProvider.hierarchyChanged argument to be required.

    This simplifies the API for users of HierarchyProvider, as they no longer need to check for undefined when handling hierarchy changes.

    For implementors of custom HierarchyProvider, this change means that they must always provide an even argument when raising the hierarchyChanged event. Since all members of the argument type are optional, it's okay to raise the even with an empty object, e.g.: this.hierarchyChanged.raiseEvent({}).

  • #1202: Change NodePreProcessor and NodePostProcessor function types to take a props object instead of a node.

    In addition, the props object now contains the parentNode property, which provides access to the parent node of the current node being processed. This allows for more context-aware processing of nodes within the hierarchy.

    The change breaks consumers that have HierarchyDefinition implementations with preProcessNode or postProcessNode functions defined. Reacting to the change is straightforward:

    const myHierarchyDefinition: HierarchyDefinition = {
      // Before:
      preProcessNode: async (node) => {
        // process node
      },
      postProcessNode: async (node) => {
        // process node
      },
    
      // After:
      preProcessNode: async ({ node, parentNode }) => {
        // process node with access to parentNode
      },
      postProcessNode: async ({ node, parentNode }) => {
        // process node with access to parentNode
      },
    
      // ... the rest of implementation
    };

Minor Changes

  • #1204: Add createHierarchyProvider utility function.

    This function simplifies the creation of custom hierarchy providers by allowing developers to define only the necessary methods, while providing default implementations for the rest. This enhancement improves developer experience and reduces boilerplate code when working with custom hierarchy providers in the @itwin/presentation-hierarchies package.

    Before:

    const beforeAsPlainObject: HierarchyProvider = {
      hierarchyChanged: new BeEvent(),
      async *getNodes({ parentNode }) {
        // yield nodes...
      },
      async *getNodeInstanceKeys() {},
      setFormatter() {},
      setHierarchySearch() {},
    };
    
    const beforeAsClassObject = new (class implements HierarchyProvider {
      public hierarchyChanged: new BeEvent(),
      public async *getNodes({ parentNode }) {
        // yield nodes...
      },
      public async *getNodeInstanceKeys() {},
      public setFormatter(formatter: IPrimitiveValueFormatter | undefined) {
        // set formatter...
        hierarchyChanged.raiseEvent({ formatterChange: { newFormatter: formatter } });
      },
      public setHierarchySearch() {},
    })();

    After:

    const afterAsPlainObject = createHierarchyProvider(() => ({
      async *getNodes({ parentNode }) {
        // yield nodes...
      },
    }));
    
    // or, provide implementation as a class instance:
    const afterAsClassObject = createHierarchyProvider(
      ({ hierarchyChanged }) =>
        new (class implements Pick<HierarchyProvider, "getNodes" | "setFormatter"> {
          public async *getNodes({ parentNode }): ReturnType<HierarchyProvider["getNodes"]> {
            // yield nodes...
          }
          public setFormatter(formatter: IPrimitiveValueFormatter | undefined) {
            // set formatter...
            hierarchyChanged.raiseEvent({ formatterChange: { newFormatter: formatter } });
          }
        })(),
    );

Patch Changes

  • Updated dependencies:
    • @itwin/presentation-shared@2.0.0-alpha.7

@itwin/presentation-shared@2.0.0-alpha.7

Major Changes

  • #1200: Made EC.RelationshipConstraint.multiplicity required.

Minor Changes

  • #1204: Add a RaisableEvent interface, which extends Event with additional raiseEvent method.

Patch Changes

  • #1198: Fix Event type to prohibit being assigned an event with no-argument listener (unless the target event uses a no-argument listener).

    Now TS will complain about the following assignment, which it previously allowed:

    const noArg: Event<() => void> = {} as any;
    const withArg: Event<(arg: number) => void> = noArg; // TS didn't complain, but it does

@itwin/presentation-core-interop@1.4.0-alpha.6

Patch Changes

  • #1200: Removed unnecessary, always-truthy condition checks.
  • Updated dependencies:
    • @itwin/presentation-shared@2.0.0-alpha.7

@itwin/presentation-hierarchies-react@2.0.0-alpha.54

Patch Changes

  • #1198: Change HierarchyProvider.hierarchyChanged argument to be required.

    This simplifies the API for users of HierarchyProvider, as they no longer need to check for undefined when handling hierarchy changes.

    For implementors of custom HierarchyProvider, this change means that they must always provide an even argument when raising the hierarchyChanged event. Since all members of the argument type are optional, it's okay to raise the even with an empty object, e.g.: this.hierarchyChanged.raiseEvent({}).

  • #1200: Removed unnecessary, always-truthy condition checks.

  • #1193: Process package output with React Compiler.

  • Updated dependencies:

    • @itwin/presentation-shared@2.0.0-alpha.7
    • @itwin/presentation-hierarchies@2.0.0-alpha.11

@imodeljs-admin imodeljs-admin requested a review from a team as a code owner February 4, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant