Skip to content

Conversation

@jewls618
Copy link

@jewls618 jewls618 commented Jan 28, 2026

Jira ticket: CP-12221

Description

The params were not being persisted when exiting preview mode.

Changes

  • Pass the params to the edit path

Demo

https://www.loom.com/share/962ebfa883524f0c81d763df3226f1df

<% unless @task_preview_mode == 'true' %>
<a href="<%= edit_template_path(@template, @auth_token || session[:auth_token] ? { auth_token: @auth_token || session[:auth_token] } : {}) %>" class="base-button" data-turbo="false" style="flex-shrink: 0; padding: 0px 24px;">
<% exit_params = {} %>
<% exit_params[:auth_token] = @auth_token || session[:auth_token] if @auth_token || session[:auth_token] %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is super confusing to me, when would we ever NOT have an auth_token here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the conditional at the end

<a href="<%= edit_template_path(@template, @auth_token || session[:auth_token] ? { auth_token: @auth_token || session[:auth_token] } : {}) %>" class="base-button" data-turbo="false" style="flex-shrink: 0; padding: 0px 24px;">
<% exit_params = {} %>
<% exit_params[:auth_token] = @auth_token || session[:auth_token] if @auth_token || session[:auth_token] %>
<% exit_params[:external_account_id] = @external_account_id if @external_account_id.present? %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading this right, we need the following:

  1. An auth_token (which should always be present, right?)
  2. An account_id or a partnership_id which would then determine where we redirect back to, either retain side or partner hub.

Is that correct?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Member

@spaulsandhu spaulsandhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to suggest leveraging some kind of presenter object here, but I think a couple of conditionals in the view are fine for now.

@jewls618 jewls618 merged commit 77b0217 into main Jan 29, 2026
5 checks passed
@jewls618 jewls618 deleted the CP-12221-exit-preview-bug branch January 29, 2026 16:28
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.

3 participants