-
Notifications
You must be signed in to change notification settings - Fork 93
feat: return sheet name and index from newSheet #373
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a nice change. Can you:
- Rebase main
- Add tests in the Rust base module also
bindings/nodejs/src/user_model.rs
Outdated
#[napi(js_name = "newSheet")] | ||
pub fn new_sheet(&mut self) -> Result<()> { | ||
self.model.new_sheet().map_err(to_js_error) | ||
self.model.new_sheet().map(|_| ()).map_err(to_js_error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would want to return the name also here to be consistent.
|
||
let result = NewSheetResult { name, sheet_index }; | ||
|
||
serde_wasm_bindgen::to_value(&result).map_err(|e| to_js_error(e.to_string())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just return (name, index)
? Maybe not I haven't tried.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LMK if changes work for you!
Rebased against main and added a test for core and user_model. |
feat: return sheet name and index from newSheet
The returned sheet_index can be directly used with other API methods like renameSheet() and setUserInput().