Skip to content

Conversation

@beNative
Copy link
Owner

Summary

  • add shared transfer utilities so drag-and-drop and explicit exports share the same payload builder
  • implement node export/import dialogs with browser and Electron file handling, plus palette/context menu commands
  • extend Electron IPC, repository logic, and types to support histories and Python settings in exported payloads

Testing

  • npm test

https://chatgpt.com/codex/tasks/task_e_68ffafe41c808332942f1cd9a6fbd121

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1284 to 1288
state.docVersions[documentId] = docVersions;

const latestVersion = docVersions[docVersions.length - 1] ?? null;

baseNode.document = {

Choose a reason for hiding this comment

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

P1 Badge Use newest history version when importing document state (browser path)

When importing nodes that contain versions, docVersions are appended in the same order they arrive. The export code populates versions from getVersionsForNode, which returns entries sorted newest-first. Because latestVersion is derived from docVersions[docVersions.length - 1], the imported document’s current_version_id and content end up pointing to the oldest revision instead of the most recent one. Users who export with “Include document history” will see stale content after importing. Reverse the array or pick the first entry when deciding which version is current.

Useful? React with 👍 / 👎.

Comment on lines +880 to 884
let latestVersionId: number | null = null;

for (const entry of normalizedVersions) {
const sha = crypto.createHash('sha256').update(entry.content).digest('hex');
const existingContent = db

Choose a reason for hiding this comment

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

P1 Badge Electron import selects oldest history version as current

The same ordering issue occurs in the Electron-backed import: the loop iterates the serialized node.versions in the order provided and assigns latestVersionId on every iteration. Because exported histories are newest-first, the value left in latestVersionId after the loop is the oldest revision, so documents.current_version_id will reference stale content even though newer versions were inserted. Imports that include histories will therefore load the wrong document content. Choose the first entry or iterate oldest-to-newest before setting the current version.

Useful? React with 👍 / 👎.

@beNative beNative closed this Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants