I have some code that looks like:
window.exampleUtils = window.exampleUtils || {}; define('example/utils', ['stash/api/util/state'], function(state) { var project = state.getProject(); var repository = state.getRepository(); window.exampleUtils.isInterestingProject = project.name === 'interesting' && repository.name === 'yes'; return window.exampleUtils ; });
I'm essentially setting up some useful variables and state, but it appears that this gets run 'too early' in that state appears not to have been populated yet.
I'm currently using this in other places and also in client-conditions, hoping to share the logic of calculating these conditions.
Is there anyway to ensure the state has been fully loaded?
Community moderators have prevented the ability to post new answers.
I assume you have left out the code for
var project = state.getProject(); var repository = state.getRepository();
Those should all be available on $(document).ready(...)
Ah, oops, yes, I did. Interesting - is there any order by which <client-conditions>s be evaluated? I would like to use the state set up here inside of these conditions for simplicity.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Updated the question to reflect what my code actually looks like In my atlassian-plugin.xml I then have: <client-condition>exampleUtils.isInterestingProject</client-condition>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The notification for your comment was lost completely in the jungle that is my gmail filters. My apologies! I'm not sure I understand your question, but the order that handlers are executed in is: on the server: <condition> (with the default context) <context-provider> (with the default context) then on the client: <client-condition> (with a combination of the default client context overridden with any properties from your server context-provider) <client-context-provider> (with a combination of the default client context overridden with any properties from your server context-provider) So unfortunately you can't use a client-context-provider to manipulate the input for your conditions. Generally what you do is you create a module to deal with all the transformations you need, and then just reuse the same code in your condition and in your context-provider or renderer if you need to. I know it's a few months later (sorry again) but let me know if I haven't answered your question or you need more help.
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.