New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix loading URL children #1422
fix loading URL children #1422
Conversation
Some code just asks for children without calling `objectHasChildren:` first.
This kinda feels like it's the wrong way round for me. I see how it makes sense but it leads me to think things might break somewhere else / later down the line. Surely the 'search contents' action should just validate on Looking at QSObjectActions.m:L38, it looks like I'm not sure what we can do about that. If we change Thoughts? |
I thought of many complicated work-arounds, too. What led me to this was one thought: You should be able to ask for an object's children without first testing to see if there are any. Some reasoning below…
We could do that, but these actions are mostly useful for triggers, so we couldn't rely on validation alone. The actions themselves would need to call it as well. And if they did, what would they do differently? Return This would apply to the "Show Contents" action too, and we'd really need to search the code for any other place that loads children and make sure it checks The only way this could cause problems down the line is if another object source came along that makes the same assumption (that "has children?" will always precede "give me the children"). The way I see it, if a class is doing something weird like that, it's the responsibility of the class to make sure it doesn't break anything. (Some background I didn't mention: I checked all the other implementations of
Or we could do what I said in #1420 (but we'd still need to make the change in this request). |
OK so I tried to think of another way of doing this but this seems like the best (going through everything you've said/tried.) merged |
This is why
Current Web Page ⇥ Search Contents
wouldn't work. If you just ask for a URL's children without ever callingobjectHasChildren:
first, the handler would always benil
.Generally, I think we should discourage making changes to an object when simply asking if it has children, but I can see why it was done in this case. Since we can keep the work-around local to the class that creates the "problem", I think it's fine.