Attached not called for component


#1

I have a component where I wanted to access some elements with ref attached.
I noticed that the ref elements were undefined when trying to access them from the activate callback.

So I have now added the attached callback. however, this never seems to fire.
What and I missing ?

My class is something like below. All callbacks fire except attached. Thanks

@inject(App, User, TaskQueue)
export class Test {
  
  created(owningView, myView) {
      // Invoked once the component is created...
      debugger;
   }

   bind(bindingContext, overrideContext) {
      // Invoked once the databinding is activated...
      debugger;
   }

  
  activate(urlParams, routeMap, navInstr) {
       debugger;
  }
  
  attached(argument) {

    debugger;
  }
}

#2

I think this may be due to my environment. I removed my node_modules and did a npm install on this machine before this bug.

My other machine works.

Not sure where the bug has come from or what package to try and downgrade though.

Maybe aurelia-cli ?


#3

Dont think attached is called when its a route, just activate() event then…
Think its only called when its a custom element or custom attribute

(I could be remembering all wrong here now)


#4

It seems to be called on my other two machines. Whether it should be I don’t know but there seems to be a bug somewhere that has been introduced. I need to go through my dependencies at some point.
Thanks


#5

attached() is called with both route views and components. For reference to all available lifecycle methods…


#6

I just tracked the problem to my materialize aurelia dependency.