-
Notifications
You must be signed in to change notification settings - Fork 161
Refreshing 'Tables' View #59
Comments
I've verified this issue and indeed it is caused by request execution order. Seems like it concerns only the tablemanagement module. At least I was able to reproduce this issue only on this page. And solution: Add appContext.currentUser promise into chain requesting tableManagement related data (getPaginatedTables function). This promise gets resolved by checkIfUserIsLoggedInAndIfSoReinitializeAppContext(). One of the drawbacks is that each promise in resolve block in stateProvider requesting data from server has to first ensure that appContext is fully initialized which obviously results in code duplication. Maybe there is a way to centralize shared code. I already implemented above approach : see #70 in pull requests. If you can come up with more sophisticated approach let me know. |
Hi, First of all - Thanks for sharing your thoughts. The problem might have affected only the tables module, but only because the lack of complexity in our sample app (besides we do not have lots of modules right now). I would definitely try to go with a general solution here. I have shortly reviewed the pull request: #70 and I would have some small remarks. Imho, putting promise chaining inside the 'tables facotry' seems to be an overkill and a kind of a patch work. There is no relation between table data itself and the user data (or even the refresh scenario). I would say that 'tables factory' does not require the knowledge about appContext.
as it might help to recognize where all the fun takes place during a digest cycle. Please do not get me wrong, I appreciate the time that you spent on analysis but in my opinion we need a solution that does not require so much attention of the developer and does not introduce superfluous dependencies for factories. I admit that I do not have a proposal from the top of my head, I will try to have a closer look and think it through as soon as I find some empty miles/spare time. I have some ideas, but don`t know yet if those are even reasonable - need to open the code/debugger. Maybe other team members will have some proposals, if not - I will definitely come back to you. Thanks again for your message, |
Hi, |
…n getting rid of relation between "tables factory" and appContext. [oasp#59]
I've just committed solution which more or less follows dumbNickname suggestions. I did a research and findings are as following. Typically, there are two possible options to overcome such an issue.
Both approaches enable us to prevent angular stateProvider from being executed before userProfile gets fully loaded but the first option seems to be more elegant at least for me and does not require developers to have a knowledge about the trick with injection of the resolved dependency between parent <-> child states. |
Hi, i like this approach much more! (even though I am not a big fan of angular events) Thanks for following the suggestion :). I gave $locationChangeSuccess as an idea because it is independent from the router implementation and $stateChangeStart is coupled with ui-router. When I checked ui-router implementation, it is internally based on mentioned $location events as well. But if you found some disadvantages of that approach, the solution with $stateChangeStart is imho fully satisfying. One really small remark - I would consider putting event handling:
into one of more generic modules, as this behavior is not only targeted at tables module - offers, sales modules need that as well. I know that end effect is the same, but I would consider this problem as a general one and so I would handle it in a place that fits general use cases. Besides it would be nice to add a small test here : ) Thanks again for investigating the topic! Cheers, |
Hi Bartek, |
So this issue can be closed and a new one should be opened with a precise problem description to be solved. |
I solved this bug in usersHavingAnyRoleOf method. |
Together with @szendo we faced some weird application behavior. Steps to reproduce:
POST http://localhost:9000/services/rest/tablemanagement/v1/table/search 403 (Forbidden)
It looks like this behavior is cased by requests execution order:
As picture shows, search is executed before CSRF token is obtained.
The text was updated successfully, but these errors were encountered: