Skip to content

Loading initial history #21

Description

@mberrishdev

When loading the initial history from the database, only the lastClipboardText or lastClipboardImage from the most recent item is preserved. However, if the most recent item is text, lastClipboardImage won't be initialized from the database. This could lead to duplicate entries being saved if the clipboard currently contains an image that was already in the database. Consider checking both the most recent text and image items separately.

        // Find the most recent text item
        const lastTextItem = this.history.find(item => item.type === "text" && item.text);
        if (lastTextItem) {
          this.lastClipboardText = lastTextItem.text;
        }
        // Find the most recent image item
        const lastImageItem = this.history.find(item => item.type === "image" && item.image);
        if (lastImageItem) {
          this.lastClipboardImage = lastImageItem.image;
        }

Originally posted by @Copilot in #19

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions