Comments (15)
I ran into the same problem as @kuhnroyal -- dynamic parameters don't work at all in any state after applying the plugin.
I'm using Angular 1.x and followed the instructions in #4 to include sticky states.
from sticky-states.
I just ran into the problem that dynamic parameters do not work at all after I apply the plugin, even without using any sticky state.
from sticky-states.
I've opened a PR in ui-router core that I think addresses this issue: ui-router/core#72
from sticky-states.
@mgerstenblatt I really appreciate the analysis and the PR! I'm a bit afraid of side effects of changing the semantics for "stock ui-router" treeChanges. It seems like sticky states itself could handle this by returning:
tc.reactivating = simulatedTC.to.slice(tc.retained.length);
do you want to try and let me know?
from sticky-states.
@christopherthielen, I don't think that approach works because when you reload a state (after updating the parameters for example) simulatedTC.to and tc.retained are the same length and you end up with an empty array.
I understand your concerns about modifying the ui-router core and would love a solution that didn't have to modify it. However, from scanning the usage of the treeChanges, I believe my changes have minimal impact.
from sticky-states.
@christopherthielen, what about doing something similar where we apply the to params like in https://github.com/ui-router/core/blob/master/src/path/pathFactory.ts#L121
from sticky-states.
@christopherthielen, something like https://github.com/ui-router/sticky-states/pull/15/files
from sticky-states.
I have faced with the issue while reactivating the sticky state with the updated dynamic parameter. (It did not update parameter at all). I did apply @mgerstenblatt patch #15 , but it still didn't work. Then I found there is missing params update for reactivating nodes in patch. I have added one line to the code and it did start to work. my updated code looks:
// Rewrite the to path
let retainedWithToParams = tc.retained.map((retainedNode,idx) => applyToParams(retainedNode,tc.to,idx));
let reactivatingWithToParams = tc.reactivating.map((retainedNode,idx) => applyToParams(retainedNode,tc.to,(idx + tc.retained.length)));
tc.to = retainedWithToParams.concat(reactivatingWithToParams).concat(tc.entering);
}
@christopherthielen, Please explain why don't you accept #15 ?
here is updated js, ts may will be useful for test src.tar.gz
from sticky-states.
I'm not seeing this issue specifically but am seeing lots of issues with query parameters.
@christopherthielen is there an ETA for fixes (this and #16, maybe related)? Would love to use this library. Unfortunately I don't have bandwidth to fix myself.
from sticky-states.
Confirmed, this is the same issue I'm experiencing. #10 is also the same issue.
from sticky-states.
Have to agree with @vladtar here...
It looks like the PathFactory really should be returning retainedWithParams
instead of retained
. It almost looks like the wrong variable was returned
or
retainedWithParams
should be included in the treeChanges
object and then the stickyStates plugin can just utilize that instead of the original retained
object.
from sticky-states.
I believe this is the issue I ran into as well and didn't fully understand what was going on as I am new to sticky states. To be honest, I still don't fully understand why it happens, but I'll explain my scenario just in case it is slightly different.
Like the OP, I have two states set up in a similar fashion with few exceptions. First, my sticky state had parameters that were not declared dynamic. Secondly, my sticky state had no url, and I was not trying to change any parameters; I was trying to return to stateB with it's original parameters (essentially a "go back" function).
Instead of everything in stateB showing up untouched, I found, through console logging, that the component that stateB was routed to was being re-initialized and it did seem like the parameters were not being passed through.
So there may be two issues here. The one that has been mentioned where the parameter is not changing, but it also seems like the sticky state is not recognizing that the state is already alive. If it did, I shouldn't be seeing the component get re-initialized.
I ended up writing a hacky workaround using a constant object to pass params and then injected that into the constant as a dependency.
For the small-scale project I ran into this on, this will do, but this is a pretty big deal breaker for use in larger scale projects.
from sticky-states.
Looks like the change I made in @uirouter/core
for this broke a lot of other things. Stay tuned.
from sticky-states.
@christopherthielen, for what it's worth, I've been using a patched version of sticky-states (https://github.com/ui-router/sticky-states/pull/15/files) instead of the change to ui-router/core in production since the summer and haven't had any issues.
from sticky-states.
Fixed by 3696bf9
from sticky-states.
Related Issues (20)
- OnRetain not called
- Sticky state resetting issue HOT 2
- Stuck sticky states HOT 1
- exitSticky typings issue HOT 1
- UI-router uiOnParamsChanged event is not triggered when StickyStatesPlugin is enabled HOT 3
- toggle show sub-views like TAB behavior
- Trouble using angularjs + npm + scripts solution HOT 1
- Action required: Greenkeeper could not be activated 🚨
- Action required: Greenkeeper could not be activated 🚨
- How to setup "sticky-states" with views HOT 11
- Using sticky-states, the destruction function is not triggered when the page is refreshed HOT 1
- Sticky states + "orphan" state + onExit = transition error HOT 3
- Error with sticky-states and chromium 40 HOT 2
- Sticky States v1.5.0 throws error in IE 11 (Object doesn't support property or method 'find') HOT 2
- Check to see if sticky state is loaded? HOT 2
- Import required even when `exitSticky` property (on `TransitionOptions`) needs to be used. HOT 1
- Load sticky state if non-sticky state was loaded from server HOT 1
- Not able to navigate back HOT 1
- How to deactivate existing sticky state HOT 1
- How to use pamas in sticky state HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sticky-states.