Skip to content

Feature/v0.0.2#3

Open
kolyasya wants to merge 27 commits intomainfrom
feature/v0.0.2
Open

Feature/v0.0.2#3
kolyasya wants to merge 27 commits intomainfrom
feature/v0.0.2

Conversation

@kolyasya
Copy link
Owner

@kolyasya kolyasya commented Feb 4, 2026

No description provided.

@kolyasya
Copy link
Owner Author

kolyasya commented Feb 4, 2026

@gemini-code-assist

@gemini-code-assist
Copy link

Summary of Changes

Hello @kolyasya, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces version v0.0.2 of the react-meteor-method-hooks package, focusing on modernizing its core functionality and improving developer ergonomics. The primary goal is to ensure compatibility with the upcoming Meteor 3.0's asynchronous method calls while offering a richer set of configuration options for method invocation, including robust parameter handling and detailed debugging capabilities. The inclusion of a complete example application serves as a practical guide for integrating these new features into existing or new Meteor/React projects.

Highlights

  • Meteor 3.0 Readiness: The useMeteorCall hook has been updated to support Meteor.callAsync() for Meteor 3.0, while maintaining backward compatibility with Meteor.call() for Meteor 2.x environments.
  • Extended Configuration Options: The hook now accepts a configuration object with new properties: cb for callbacks, validate for parameter validation, transform for parameter modification, forceSyncCall to explicitly use Meteor.call(), logging for console output, and suppressErrorLogging to control error logging.
  • Dynamic Parameter Overrides: Users can now provide initial parameters when defining the hook and then override them dynamically when invoking the methodHandler function.
  • Comprehensive Example Application: A new example directory has been added, providing a full-fledged Meteor/React/TypeScript application that demonstrates the practical usage of all new features and configurations of the useMeteorCall hook.
  • Improved Package Structure and Type Safety: The package's internal structure has been reorganized, and TypeScript type definitions (types.d.ts) have been introduced to enhance developer experience and ensure type safety.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .gitignore
    • Added .DS_Store to the ignore list.
  • README.md
    • Updated the usage example to showcase the new configuration options and Meteor.callAsync() support.
  • example/.gitignore
    • Added node_modules/ to ignore list for the example project.
  • example/.meteor/.finished-upgraders
    • Added Meteor upgrade history file.
  • example/.meteor/.gitignore
    • Added local to ignore list for Meteor's local directory.
  • example/.meteor/.id
    • Added Meteor project ID file.
  • example/.meteor/packages
    • Added Meteor package list for the example, including typescript and react-meteor-data.
  • example/.meteor/platforms
    • Added platform configuration (server, browser).
  • example/.meteor/release
    • Set Meteor version to METEOR@2.16.
  • example/.meteor/versions
    • Added detailed Meteor package versions.
  • example/client/main.css
    • Added basic styling for the example app.
  • example/client/main.html
    • Added HTML structure for the React app.
  • example/client/main.tsx
    • Added client-side entry point for the example React app.
  • example/imports/api/links.ts
    • Added Link interface and LinksCollection definition for the example.
  • example/imports/ui/App.tsx
    • Added example React component demonstrating useMeteorCall with new features.
  • example/imports/ui/react-meteor-method-hooks/types.d.ts
    • Added TypeScript type definitions for the hook.
  • example/imports/ui/react-meteor-method-hooks/useMeteorCall.js
    • Added the core implementation of the enhanced useMeteorCall hook.
  • example/package-lock.json
    • Added package-lock.json for the example project.
  • example/package.json
    • Added package.json for the example project, including React and TypeScript dependencies.
  • example/server/main.ts
    • Added server-side Meteor methods and data initialization for the example.
  • example/tests/main.ts
    • Added basic test file for the example project.
  • example/tsconfig.json
    • Added TypeScript configuration for the example project.
  • index.js
    • Removed the previous, simpler implementation of the useMeteorCall hook.
  • package.json
    • Updated package version to 0.0.2-beta.10.
    • Adjusted main and added types and files fields to point to the new src directory.
    • Removed the test script.
  • pre-publish.sh
    • Added a shell script to copy the hook's source files and type definitions into a src directory for publishing.
  • src/types.d.ts
    • Added TypeScript type definitions for the hook (final package location).
  • src/useMeteorCall.js
    • Added the core implementation of the enhanced useMeteorCall hook (final package location).
Activity
  • The author, kolyasya, initiated this pull request to release Feature/v0.0.2.
  • The changes represent a significant update to the react-meteor-method-hooks package, including a complete rewrite of the core hook logic, the addition of a comprehensive example application, and updates to the package's metadata and build process.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a significant update, refactoring the useMeteorCall hook to support the new Meteor.callAsync API while maintaining backward compatibility. It also introduces a comprehensive example application, which is a great addition for users. My review focuses on improving error handling robustness, code clarity in the example, and suggesting a more conventional project structure for better maintainability. I've identified a critical issue in error handling that could lead to application crashes, along with other high and medium severity suggestions to enhance the code quality.

Comment on lines +31 to +33
return console.error(
`This package only works in Meteor environment. Check https://www.meteor.com/`
);

Choose a reason for hiding this comment

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

critical

Returning console.error here will cause the application to crash when destructuring the hook's return value, as console.error does not return an iterable. This check should instead throw an error to halt execution and provide a clear message, which is a standard practice for unrecoverable errors in React hooks.

Suggested change
return console.error(
`This package only works in Meteor environment. Check https://www.meteor.com/`
);
throw new Error(
`This package only works in Meteor environment. Check https://www.meteor.com/`
);

}

if (!name) {
console.error('Name is required to call Meteor method');

Choose a reason for hiding this comment

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

high

Calling console.error without stopping the hook's execution can lead to unpredictable behavior. The hook will continue to render, and the returned methodHandler will fail later when called without a valid method name. It's better to throw an error immediately to prevent further issues.

Suggested change
console.error('Name is required to call Meteor method');
throw new Error('Name is required to call Meteor method');

Comment on lines +50 to +52
// methodWithResult('one', 'two', 'three');
// methodWithResult();
// methodWithResult({});

Choose a reason for hiding this comment

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

medium

This file contains commented-out code. If this code is no longer needed, it should be removed to improve code clarity and maintainability. If it's for demonstration, it would be better to explain its purpose in a comment rather than leaving dangling code.

Comment on lines +1 to +10
#!/bin/bash

# Script to prepare the package structure before npm publish

# Remove existing files and directories
rm -rf ./src

# Create a new directory structure
mkdir ./src
cp ./example/imports/ui/react-meteor-method-hooks/* ./src

Choose a reason for hiding this comment

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

medium

This script copies the package source code from the example directory into src before publishing. This project structure is unconventional and can be confusing for new contributors, as the source of truth is not in the expected src directory. Consider refactoring the project to have the package source code live in src and have the example application import from there. This would make the project structure more standard and easier to maintain.

}

setLoading(false);
setError('Params validation failed on method call');

Choose a reason for hiding this comment

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

medium

The error state is being set to a plain string here, but for other errors (like from Meteor.callAsync), it's set to an error object. This inconsistency can make error handling difficult for the consumer of the hook. To ensure a consistent error structure, it would be better to set an error object that mimics Meteor's error format.

Suggested change
setError('Params validation failed on method call');
setError({ reason: 'Params validation failed on method call' });

@gemini-code-assist
Copy link

Hello @kolyasya! I've provided a summary of the pull request above. Please let me know if you have any specific questions about the changes, the review, or if there's anything else I can assist you with. You can also use /gemini help to see a list of available commands.

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