Skip to content
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: router conflict with error tracker #4

Merged

Conversation

cbuctok
Copy link
Contributor

@cbuctok cbuctok commented Sep 10, 2024

I suggest moving the function in question into helpers module

@cbuctok cbuctok force-pushed the issues/2-Router-conflict-with-ErrorTracker branch from 7c58470 to 88e62c6 Compare September 10, 2024 09:23
Moved parse_options/2 to PhoenixAnalytics.Web.RouterHelpers module
@cbuctok cbuctok force-pushed the issues/2-Router-conflict-with-ErrorTracker branch from 88e62c6 to a0ac90a Compare September 10, 2024 09:30
@lalabuy948
Copy link
Owner

Since this file is relatively small and has one single purpose to have macro for phoenix router I would go with this, instead of moving it to separate file:

  defmacro phoenix_analytics_dashboard(path, opts \\ []) do
    quote bind_quoted: [path: path, opts: opts] do
      scoped_path = Phoenix.Router.scoped_path(__MODULE__, path)

      custom_on_mount = Keyword.get(opts, :on_mount, [])

      on_mount =
        [{PhoenixAnalytics.Web.Hooks.SetAssigns, {:set_dashboard_path, path}}] ++ custom_on_mount

      session_name = Keyword.get(opts, :as, :phoenix_analytics_dashboard)

      session_opts = [
        on_mount: on_mount,
        root_layout: {PhoenixAnalytics.Web.Layouts, :root}
      ]

      scope path, alias: false, as: false do
        import Phoenix.LiveView.Router, only: [live: 4, live_session: 3]

        live_session session_name, session_opts do
          live("/", PhoenixAnalytics.Web.Live.Dashboard, :index, as: session_name)
        end
      end
    end
  end

@cbuctok cbuctok changed the base branch from master to 0.1.2 September 10, 2024 10:23
Moved `parse_options/2` into `phoenix_analytics_dashboard` macro
@cbuctok
Copy link
Contributor Author

cbuctok commented Sep 10, 2024

@lalabuy948 makes sense! Done!

@lalabuy948 lalabuy948 merged commit 778b675 into lalabuy948:0.1.2 Sep 10, 2024
@cbuctok cbuctok deleted the issues/2-Router-conflict-with-ErrorTracker branch September 10, 2024 10:47
lalabuy948 added a commit that referenced this pull request Sep 10, 2024
* fix: router conflict with error tracker (#4)

* fix: Router conflict with ErrorTracker

Moved `parse_options/2` into `phoenix_analytics_dashboard` macro

---------

Co-authored-by: Greg Evseev <[email protected]>

* version bump

* fix: update phoenix_analytics path in Mix.install (#3)

* fix: update phoenix_analytics path in Mix.install

Changed the path of phoenix_analytics from a relative external path to the local directory to ensure proper dependency loading.

Add `ip: {0, 0, 0, 0}` to endpoint_options

---------

Co-authored-by: Greg Evseev <[email protected]>

---------

Co-authored-by: Greg <[email protected]>
Co-authored-by: Greg Evseev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants