-
-
Notifications
You must be signed in to change notification settings - Fork 321
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
Implement use_location #721
Conversation
still need to rework how modules are accessed
Can you shoot me a sample snippet of the syntax for this so I can test? |
@Archmonger here's a demo of how it should work: from idom import html, component, run
from idom.server import starlette as server
@component
def ShowLocation():
loc = server.use_location()
return html.h1(loc.pathname + loc.search)
run(ShowLocation, implementation=server) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to rename the PR to "use_location hook"
since this isn't routing, but rather location propagation.
Routing = integrated support for rendering different components based on regex path
if we poll sync then the server might not ever get a hold of the event loop. this was causing a problem for the sanic server in a test
@Archmonger, any idea why this test is failing on Windows? |
The way that test is written, I wouldn't expect it to raise anything on any OS? From what I can tell,
Why would you expect |
Scratch that, I see you're trying to symlink the empty I don't think this is a valid test case to be honest. If the user intentionally symlinked a file into our dir, we should consider it safe. In general, symlinks/hardlinks should be considered as "real files" within both their given directories. If you want this to fail for some reason, you'd need to use |
By providing access to a
use_location
hook, users can implement primitive routing. The catch is that, at present, state will not be persisted as users navigate between routes. Support for that will have to come in a future update.