How to correctly open an ItemView?

In the unofficial documentation, the best way to open a custom view is to first register the view:

      (leaf) => new ExampleView(leaf)

And then activate the view:

  async activateView() {;

      type: VIEW_TYPE_EXAMPLE,
      active: true,

but this solution doesn’t seem to fit my need( I need to pass in params ). I’m currently opening an ItemView from a prompt. And I’ve got the view appearing with my passed in parameters like such:

      type: VIEW_TYPE_EXAMPLE,
      active: true

  const leaf =[0]
              TestItemView(leaf, params))

Notice I don’t have to register the view at all. I’m left wondering, is this an alright way to open a view? I tried setting the view state (setViewState) while implementing the original way, but was unable to actually retrieve the passed in values within the custom view.

I don’t know that it answers your question, but the unofficial documentation has been replaced by official documentation:

1 Like

Thank you for the response, but sadly it doesn’t help. I mainly referred to the unofficial documentation due to the example they provided.

Here’s an easy way to pass the params

	(leaf) => new CustomPluginView(leaf, *your_param)

Correspondingly, in the view component, accept the params

export class CustomPluginView extends ItemView {
    param: type_of_param

	constructor(leaf: WorkspaceLeaf, param: type_of_param) {
		this.param = param;

The calling of the view activateView() stays the same.