I am trying to investigate the way _the one_ tutorial for BranchSelector works:
https://bitbucket.org/atlassian/stash-example-hook-protect-ref
with one detail : It doesnt work! It fails with error.
The error is:
Uncaught TypeError: Cannot call method 'getProject' of undefined (revision-reference-selector.js:181)
RevisionReferenceSelector.prototype.getBranchesUrl = function(){ return nav.rest().project(this.repository.getProject()).repo(this.repository).branches().build(); -- Uncaught TypeError: Cannot call method 'getProject' of undefined };
Community moderators have prevented the ability to post new answers.
It fixed in 2.6.0 due to bugreport.
You are correct about 1 and 2, but 3 is a bit different. `getProject()` on that line is not being called on pageState, but on a Repository object. `Repository.prototype.getProject()` IS formed dynamically, but it exists immediately on any repository. The actual issue is that there is no repository when we reach that line in the code. so when we run this.repository.getProject() we are calling undefined.getProject() which fails.
However, I've not been able to produce this so I don't understand what's going on for you.
Here is what should happen:
If that's not how you're using the branch selector field, then please give me more details on how you're using it. You might need to manually add a dependency on it, or manually call `pageState.setRepository(repoJson);` for your page (which is a bit dirty) or change it to use one of the repository decorators.
If that is how you're using the branch selector field, you may benefit from debugging into `initRepositoryPageState` in /layout/repository/repository.js . The repository should be added to pageState in that function. Perhaps a previous error is causing that not to run, or later code is overwriting it for some reason. This is hard for me to help with since I can't reproduce your problem locally.
Cheers,
Adam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.