Help! I have an app.js module whose activate method is called (router lifecycle) but then no component lifecycle methods are invoked (neither bind() nor attached()). My activate() method returns a Promise and successfully resolves, but the SPA hangs at this point.
Looking for insights as to why component lifecycle methods would not be called, or approaches I can use to analyze the reason.
Specific details: rather than browsing to the server which delivers index.html, I am POSTing to the same server requesting index.html as a text response, saving that file to my desktop and then opening it as file:///C:/Users/myusername/Desktop/index.html. The contents of index.html are identical to what the server delivers when browsing to the server.
In FireFox, I observe debugger logging of files being imported:
App:activate(): resolving! app-bundle.js:1:537457
DEBUG [templating] importing resources for app.html
… followed by imports of 16-17 files, at which point things just stop.
First off, welcome to the community!
I saw your post didn’t have a response after 24 hours. Thought I would do my best to try to help.
May I ask why you’re doing this?
It sounds like your intention may be to have the Aurelia app basically “generate” a downloadable version of the site/page. Someone please correct me if I’m wrong, but I don’t believe this will work as “index.html” would not contain the scripts necessary for the site/page to execute lifecycle, or any, events.
I’m also unclear as to when the DEBUG message(s) are occurring. Is it during the POST request? In your top paragraph it sounds like you are having success up to a point, but it’s unclear if this success is with the Aurelia app running on the server or the within index.html that’s returned and saved locally.
Any clarification you can provide would be appreciated.
I figured this out, and it is very interesting. First, why I need to do this:
Our node server needs to respond to POST of some XML so a 3rd party can get a copy of index.html with parameters parsed from that XML embedded. The SPA will then notice these params and launch differently from the usual way.
I am building a test harness for the POST and want to launch a new window with the response. This harness will be very similar to the use case of the 3rd party.
The solution was to have 2 forms, the first with the input’s for the parameters. When that form is submitted, the parameters are collected and formatted into a string of XML. This string of XML is then inserted into the body of the 2nd form, whereupon that form is submitted using POST to the node server. The target property of the 2nd form is set to “_blank”, so the new window simply open to the index.html of the response to the POST.
Once the index.html is received into a page whose domain in the URL window is correct, the app launch goes perfectly - no more hangup.
It was a little mind-bending, but the approach works and the plumbing is working, despite a couple of pipes that need tightening. Thanks for your response.
Glad to hear you got it working! Definitely sounds quite mind-bending.