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) |
Archmonger
left a comment
There was a problem hiding this comment.
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_locationhook, 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.