You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this app flowhasissue.zip, when /App/Content is No, then the button on /App/EditOneAction shouldn't have isSelected set to true because /App/Content/Content/Edit/One isn't set.
The expected behaviour would be that the flow.has method goes all the way up trying to find whether a parent of the view being checked is in fact in the flow, be it that it is a default view of an active path or not.
A workaround for now is to add a new view called No in /App/Content/Content/Edit.
Side note:
Since that'll be a recursive operation, it might be slow. Since these checks happen on every render I suggest that whenever we implement this we also consider adding a local cache to flow.has, something like this:
export function useFlow() {
let state = useFlowState()
return useMemo(() => {
let _has = {}
return {
has: key => {
if (!key) return false
if (!(key in _has)) {
_has[key] = calculate()
}
return _has[key]
function calculate() {
// ...the actual logic we have in there now plus the changes
}
},
flow: state.flow,
}
}, [state.flow])
}
This will need to be tested for side effects with flow items with arguments (eg, a list gets a new item or the item gets removed) but in principle it should work as-is.
The text was updated successfully, but these errors were encountered:
In this app flowhasissue.zip, when
/App/Content
isNo
, then the button on/App/EditOneAction
shouldn't haveisSelected
set to true because/App/Content/Content/Edit/One
isn't set.What happens now is that because
One
is the default view in/App/Content/Content/Edit
, it wins because of this https://github.com/viewstools/morph/blob/master/views/ViewsFlow.js#L104.The expected behaviour would be that the
flow.has
method goes all the way up trying to find whether a parent of the view being checked is in fact in the flow, be it that it is a default view of an active path or not.A workaround for now is to add a new view called
No
in/App/Content/Content/Edit
.Side note:
Since that'll be a recursive operation, it might be slow. Since these checks happen on every render I suggest that whenever we implement this we also consider adding a local cache to
flow.has
, something like this:This will need to be tested for side effects with flow items with arguments (eg, a list gets a new item or the item gets removed) but in principle it should work as-is.
The text was updated successfully, but these errors were encountered: