Skip to content

Add documentation for rx.memo decorator #1331

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

devin-ai-integration[bot]
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Apr 30, 2025

Documentation for rx.memo

This PR adds comprehensive documentation for the rx.memo decorator in the Reflex web documentation.

Changes

  • Added detailed documentation for rx.memo with examples showing:
    • Basic usage
    • Usage with event handlers
    • Usage with state variables
    • Performance considerations

Notes

  • The HTML documentation is already in the "Other" section, so no changes were needed there
  • The CI failures appear to be flaky Playwright tests unrelated to these documentation changes

Link to Devin run: https://app.devin.ai/sessions/e3e91c937b32476cb34b9dc0f18bd45a
Requested by: Alek Petuskey ([email protected])

Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Contributor Author

The CI failure appears to be a flaky test unrelated to our documentation changes. Let's trigger a new CI run.

Copy link
Contributor Author

The CI failure appears to be a flaky Playwright test unrelated to our documentation changes. This is likely due to the nextjs-portal intercepting pointer events during the test. Let's rerun the CI checks.

Copy link
Member

@adhami3310 adhami3310 left a comment

Choose a reason for hiding this comment

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

one of the requirements in rx.memo is typing all of the arguments, you should state that and update all of your examples to type their arguments

you should also mention that memo requires the caller to call it with kwargs and not positional arguments

Comment on lines +25 to +26
def increment(self):
self.count += 1
Copy link
Member

Choose a reason for hiding this comment

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

you should add @event decorator to your events for consistency

@rx.memo
def expensive_component(label: str) -> rx.Component:
return rx.vstack(
rx.heading(label, size="lg"),
Copy link
Member

Choose a reason for hiding this comment

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

lg is not a valid arg

Comment on lines +60 to +61
def increment(self):
self.clicks += 1
Copy link
Member

Choose a reason for hiding this comment

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

you should add @event decorator to your events for consistency

Comment on lines 87 to 91
def increment(self):
self.count += 1

def set_name(self, name: str):
self.name = name
Copy link
Member

Choose a reason for hiding this comment

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

you should add @event decorator to your events for consistency

Comment on lines +119 to +120
def set_message(self, text: str):
self.message = text
Copy link
Member

Choose a reason for hiding this comment

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

you should add @event decorator to your events for consistency

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.

2 participants