Skip to content
Snippets Groups Projects

Resolve #3459235 POC "React router"

Merged Jesse Baker requested to merge issue/experience_builder-3459235:3459235-react-router into 0.x
1 unresolved thread

Closes #3459235

POC of how I would like to implement React Router to put in place the architecture for handling tying UI state/views to the URL route.

At the moment it ties the route param of componentID to the selectedComponent in the UI slice. Updating the state will update the URL and updating the URL will update the state. I am unsure if this is wise - or if a better approach would be a single source of truth in the URL and remove the selected component from the state altogether.

While this PoC is very basic as there is very little to the XB app so far, I think React Router provides a robust, scalable solution for navigation and view management. What I hope to enable with this architecture, in the future, is the ability for us to easily scale the XB app to have more views, different settings pages, navigation between editing components and pages and templates etc. In addition it will allows users to navigate using URLs by copy and pasting the URL to other people they are collaborating with - just as they might expect to do with a backend application (hey Jane, please take a look at www.foo.com/admin/node/1/edit and review the copy)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Ben Mullins resolved all threads

    resolved all threads

  • Ben Mullins added 1 commit

    added 1 commit

    • d64e1aa1 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • Ben Mullins
  • Ben Mullins
  • Jesse Baker added 1 commit

    added 1 commit

    • 2add475f - resovle contrast and re-introduce tests

    Compare with previous version

  • Ben Mullins added 4 commits

    added 4 commits

    Compare with previous version

  • Ben Mullins added 1 commit

    added 1 commit

    Compare with previous version

  • Ben Mullins added 2 commits

    added 2 commits

    • d265cedd - ci isn't checking prettier yet so please dont run prettier
    • dc275cd5 - let refresh work ok

    Compare with previous version

  • Ben Mullins added 1 commit

    added 1 commit

    Compare with previous version

  • Ben Mullins added 1 commit

    added 1 commit

    • e71d05d1 - linting and better messages to help explain WTH back button does not seem to work on Gitlab CI

    Compare with previous version

  • Ben Mullins added 1 commit

    added 1 commit

    • 30dbb90a - no pink is good contrast apparently

    Compare with previous version

  • Ben Mullins approved this merge request

    approved this merge request

  • Ben Mullins added 3 commits

    added 3 commits

    Compare with previous version

  • 25 27 </html>
    26 28 HTML;
    27 29
    28 public function content() : HtmlResponse {
    30 public function content(string|null $react_route = NULL, string|null $react_subroute = NULL) : HtmlResponse|RedirectResponse {
    31 if (!empty($react_route)) {
    32 // Temporary measure so refreshing a page with a component selected does
    33 // not result in a 404.
    • Comment on lines +32 to +33
      Suggested change
      Applied
      32 // Temporary measure so refreshing a page with a component selected does
      33 // not result in a 404.
      32 // Temporary measure so refreshing a page with a component selected does
      33 // not result in a 404.
      34 // @todo Investigate how https://www.drupal.org/project/decoupled_pages solved this same problem.
    • I wonder why we didn't use the Hash router - feels like it would have been the better option

    • Please register or sign in to reply
  • Wim Leers added 1 commit

    added 1 commit

    • bdaa0d35 - Add `@todo` to make connection of this problem with...

    Compare with previous version

  • Ben Mullins added 7 commits

    added 7 commits

    Compare with previous version

  • Ben Mullins added 5 commits

    added 5 commits

    Compare with previous version

  • Ben Mullins added 1 commit

    added 1 commit

    • a803b95f - a new test had to stop looking for drawer

    Compare with previous version

  • Ben Mullins resolved all threads

    resolved all threads

  • Ben Mullins added 1 commit

    added 1 commit

    Compare with previous version

  • Harumi Jang
  • Harumi Jang added 1 commit

    added 1 commit

    Compare with previous version

  • Harumi Jang added 1 commit

    added 1 commit

    Compare with previous version

  • Harumi Jang resolved all threads

    resolved all threads

  • Harumi Jang approved this merge request

    approved this merge request

  • merged

  • Wim Leers mentioned in merge request !84 (closed)

    mentioned in merge request !84 (closed)

  • Please register or sign in to reply
    Loading