ctron / yew-oauth2

General purpose OAuth2 component for Yew
Apache License 2.0
44 stars 17 forks source link

feat: migrate to Yew 0.20, using yew-nested-router in the process #11

Closed ctron closed 1 year ago

ctron commented 1 year ago

This rewrites some of the internals, as Yew dropped the support for Agents.

closes #5

andar1an commented 1 year ago

So the main changes for this upgrade are using the new nested router crate which you created, leveraging the original style of router? That currently does not have history, but that should be okay if using something like yewdux right?

andar1an commented 1 year ago

This rewrites some of the internals, as Yew dropped the support for Agents.

closes #5

What are agents used for? Why did they drop support for them?

ctron commented 1 year ago

This rewrites some of the internals, as Yew dropped the support for Agents. closes #5

What are agents used for? Why did they drop support for them?

There was an agent, managing the internal state. The agent was basically and actor pattern (similar to actix) that made it easier to maintain a mutable state.

The change now is to basically re-implement the necessary bits in this crate.

yew-agent supported two modes of operation: "context" and "web workers". Context was running in the single browser thread, leveraging the "context" idea of Yew (similar to the components). Web workers are far more complex.

The argument is, that the "context" style agents are now no longer necessary as Yew bring the new "context" system (use_context and <ContextProvider<T>>. And there is a general push for "function components".

ctron commented 1 year ago

So the main changes for this upgrade are using the new nested router crate which you created, leveraging the original style of router? That currently does not have history, but that should be okay if using something like yewdux right?

The two main changes are: replace the yew-agent based Agent with a custom wrapper, which offers the necessary decoupling to let the OAuth2 state run in an agent-style fashion, but fully tie it in to the new use_context style.

Second, to replace the (optional) router integration with the new yew-nested-router. Still this is optional.

The current implementation leverages the browser history, so just pressing the back button on the browser should take you back to the previous route (not the previous page).

andar1an commented 1 year ago

This is so cool, thank you for sharing your knowledge! Do you have a Slack channel for your projects? It would be awesome to chat outside of PR

ctron commented 1 year ago

I am mostly on Matrix these days (@ctron:dentrassi.de). I can create a room there is you think this makes sense.

andar1an commented 1 year ago

I am mostly on Matrix these days (@ctron:dentrassi.de). I can create a room there is you think this makes sense.

Very cool, that would be great! Thank you

ctron commented 1 year ago

I am mostly on Matrix these days (@ctron:dentrassi.de). I can create a room there is you think this makes sense.

Very cool, that would be great! Thank you

Any suggestion for a name that fits? yew-oauth2 sounds plain boring :D

andar1an commented 1 year ago

I am mostly on Matrix these days (@ctron:dentrassi.de). I can create a room there is you think this makes sense.

Very cool, that would be great! Thank you

Any suggestion for a name that fits? yew-oauth2 sounds plain boring :D

What about yew-authorized (like "you are authorized" slang, and because it does openid connect too? Haha) Still boring?

ctron commented 1 year ago

I created #yew-tools:matrix.org, which might also cover the patternfly-yew project and the router stuff.