Closed robertmoura closed 3 days ago
I'm not entirely sure how the trees are structured or created. I had to update the code to check that the parent was the root. Can you think of any cases where this would not work?
Do you have a bug reproduction? This doesn't seem to be fixing something 😅 Changing paths with non absolute routes is not supported yet #341
Quite right! It's actually more of a feature 😊 https://github.com/posva/unplugin-vue-router/issues/341 is exactly the problem I was trying to solve 😊
I think I'm seeing the problem now. Here's a snippet out of TreeNode
. The path is assumed to be relative (a path segment) or absolute if there is a path override. Interesting behaviour... There has to be a bit more thought put into this. The way I'd expect this to work would mean that the current behaviour would be broken. Just going to close this for now 😊 I might come up with something later. We'll see 😄
get path() {
return (
this.value.overrides.path ??
(this.parent?.isRoot() ? '/' : '') + this.value.pathSegment
)
}
If we were to make a slight change to the behaviour of the TreeNode
's fullPath
getter I think relative paths could be supported. It would be a breaking change though. Can you see any reasons why this would be a bad idea?
I just need to think a little about what this would mean for the route block and definePage
.
The fullPath shouldn’t change its behavior, or at least it shouldn’t be needed
I'll have a look at where it is being used and see if I can remove it 😊
Sorry, I was overcomplicating this a lot. I didn't realise that you could have absolute paths as child routes. I just assumed you had to put an extra /
in the URL or something. Does what I'm doing now make more sense?
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 73.61%. Comparing base (
75160e0
) to head (16807d7
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Looking good. I will probably give this a review and merge next Monday during the stream
Closing in favour of https://github.com/posva/unplugin-vue-router/pull/519
BREAKING CHANGE: allow relative path overrides
Closes https://github.com/posva/unplugin-vue-router/issues/341
EditableTreeNode