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

Track links and embeds in the composer reducer #5593

Merged
merged 3 commits into from
Oct 4, 2024
Merged

Track links and embeds in the composer reducer #5593

merged 3 commits into from
Oct 4, 2024

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Oct 3, 2024

This adds tracking of remaining embed/media types to the composer reducer.

They're not being used for anything yet, but you should roughly expect their state to mirror how the composer works today. (There are also some improvements. For example, pasting a quote link after a regular link will correctly mark a quote in the reducer state, whereas the old composer logic was not able to handle that.)

In future PRs, I will be making this the source of truth for two things:

  • Composer preview
  • Publishing a post

However we're missing some pieces to be able to do that, so for now it's not connected yet.

Note that in the draft, we don't distinguish between different types of links (other than quote/other distinction). This is because they're only relevant for preview and for posting. They're not important in the draft data model because the reducer behavior ("which field gets replaced by which field in which cases") doesn't care about the contents of the link beyond that.

Test Plan

Add console.log(composerState) to Composer.tsx. Verify the composerState.embed fields evolve as you'd expect when you add GIF, add/remove media, paste links, remove GIF, remove links, etc.

Copy link

github-actions bot commented Oct 3, 2024

Old size New size Diff
7.91 MB 7.91 MB 858 B (0.01%)

These don't map 1:1 to the record structure. Rather, we select data from the draft on posting.
@arcalinea arcalinea temporarily deployed to embed-5 - social-app PR #5593 October 4, 2024 15:37 — with Render Destroyed
Copy link
Member

@estrattonbailey estrattonbailey left a comment

Choose a reason for hiding this comment

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

Omg it's so much nicer

@gaearon gaearon merged commit 282db85 into main Oct 4, 2024
6 checks passed
@gaearon gaearon deleted the embed-5 branch October 4, 2024 18:39
estrattonbailey added a commit that referenced this pull request Oct 4, 2024
* origin/main:
  Make composer reducer source of truth for images/video when publishing (#5595)
  Track links and embeds in the composer reducer (#5593)
  Bump SDK (#5602)
  Update built asset caching (#5601)
  Downgrade sentry to recommended 5.24.3 (#5604)
  Add option to search in any language (#5598)
  Font tweaks (#5597)
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