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

Copy-pasting a FK cell should use the value not the record summary #4295

Open
pavish opened this issue Mar 2, 2025 · 3 comments
Open

Copy-pasting a FK cell should use the value not the record summary #4295

pavish opened this issue Mar 2, 2025 · 3 comments
Labels
needs: requirements The problem is clear and worth solving, but we're not yet sure of the best solution restricted: maintainers Only maintainers can resolve this issue type: enhancement work: frontend Related to frontend code in the mathesar_ui directory
Milestone

Comments

@pavish
Copy link
Member

pavish commented Mar 2, 2025

Current behavior

When copying a foreign key cell and pasting the value into a text cell, Mathesar pastes the record summary for the linked record.

Desired behavior

I do not think copying foreign key values should result in pasting the record summary string. I think it should always only be the value stored in the column.

Rationale

  • It's essential that the user understands that the record summary is not the content stored on the db, but a summary of the actual referenced row. We already display the values differently on the UI, with a pill.
  • What happens when the foreign key is a text column referencing a text column from another table? How would copying such a value into a text column work? (Right now, record summaries will fail for it, but this is a question I'd like us to think about).
  • We could make this behaviour configurable in the future, but for now, I think it should directly copy the underlying value.

Additional context

@pavish pavish added ready Ready for implementation restricted: maintainers Only maintainers can resolve this issue type: enhancement work: frontend Related to frontend code in the mathesar_ui directory labels Mar 2, 2025
@pavish pavish added this to the v0.2.2 milestone Mar 2, 2025
@pavish pavish added needs: requirements The problem is clear and worth solving, but we're not yet sure of the best solution and removed ready Ready for implementation labels Mar 3, 2025
@pavish pavish changed the title Follow up on Copy Paste behaviour Follow up on copy-paste: Foreign key values & Record summary Mar 3, 2025
@seancolsen seancolsen changed the title Follow up on copy-paste: Foreign key values & Record summary Copy-pasting a FK cell should use the value not the record summary Mar 3, 2025
@seancolsen
Copy link
Contributor

seancolsen commented Mar 3, 2025

@pavish I have a couple questions:

  1. We currently have this modal confirmation:

    Image

    What would you think about utilizing that confirmation dialog to ask the user how they'd like to paste? We could use a radio group like this:

    Paste 2 cells?

    Formatting

    • (•) Paste Formatted Values
    • ( ) Paste Raw Values

    Note that what I'm proposing would also affect other values like dates.

    If this works for you, I would have a slight preference for keeping "Past Formatted Values" as the default choice since I think it's what users would want in most cases. But I'd be open to making "Paste Raw Values" the default if you feel strongly about it.

  2. Currently, when copying FK cells and pasting into an application outside Mathesar, the data is serialized to TSV using record summaries. Is this behavior okay with you? This has been the case for a couple years now.

@pavish
Copy link
Member Author

pavish commented Mar 3, 2025

@seancolsen

  1. I'm on board with providing an option to let the user choose if they want to paste formatted values or raw values (for any column types containing formatted values - eg., date).

    • However, we should use different text for Foreign keys, since it's not technically "formatting".
    • I'm also on board with keeping the "Paste Formatted Values" as the default choice.
  2. Currently, when copying FK cells and pasting into an application outside Mathesar, the data is serialized to TSV using record summaries. Is this behavior okay with you? This has been the case for a couple years now.

    I don't think that this should be the behaviour for FK cells. I think it should paste the raw value and not the record summary. That said, I'm not leaning towards it too strongly. I would just like to have a discussion open. We should consider scenarios such as:

    • What if users are pasting to a competing/similar db product to Mathesar.
    • What if the FK column is a string column or UUID? Users might want to see a name instead of the UUID in the summary but copy the underlying UUID.

@seancolsen
Copy link
Contributor

@pavish I think we're relatively close to figuring out what needs to be done here, but we still have some unanswered questions and open-ended problems to solve. And, while I don't see the implementation being huge, I don't see it being trivial either. So at this point I'm starting to wonder how much of a priority it is to continue hashing this out. Personally, I don't think this needs to go in 0.2.2. Could we put this in Backlog, unassign me from it, and pick it up later when it becomes a higher priority?

@pavish pavish modified the milestones: v0.2.2, Backlog Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: requirements The problem is clear and worth solving, but we're not yet sure of the best solution restricted: maintainers Only maintainers can resolve this issue type: enhancement work: frontend Related to frontend code in the mathesar_ui directory
Projects
None yet
Development

No branches or pull requests

2 participants