Skip to content

on_new callback on save_load widget is not well documented #4

@mrdobalina2k

Description

@mrdobalina2k

I could see from the typescript, that on_new is called whenever you chose "save as". I would expect the save_as callback to be called "save_as", and that there would be a "New item" ui element that would call the "on_new" callback in that case.

 <SaveAsDialog
        isOpen={isSaveAsDialogOpen}
        onClose={() => setIsSaveAsDialogOpen(false)}
        onSubmit={(name) => {
          if (showSaveConfirmation) {
            showSaveConfirmation(
              `Are you sure you want to save as "${name}"? This will create a new item with your current data.`, 
              () => {
                handleNew(name);
                onClose();
              },
              "Confirm Save As"
            );
          } else {
            handleNew(name);
            onClose();
          }
        }}
        defaultName={selectedId ? 
          (items.find(item => item.id === selectedId)?.label || "") + " (Copy)" : 
          "New Item"}
      />

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions