Skip to content
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

Fix: Framegear with Multiple Text Inputs #1218

Merged
merged 3 commits into from
Sep 6, 2024
Merged

Conversation

brendan-defi
Copy link
Contributor

What changed? Why?

  • Currently, when using Framegear, if there are multiple frames with text input fields, the inputText state will persist to the latter frames (ie. if a user inputs "blah" in the first input field, and the next frame has an input field, that field will be pre-filled with "blah"

  • This PR fixes the issue by enabling Framegear to better handle multiple text inputs

    • achieved by creating a TextInputs context
    • leveraged useTextInputs in FrameInput and Frame to appropriately reset inputText state for various frame changes
    • the following frame interactions reset the inputText state:
      • FrameInput's fetch button
      • Any post or post_redirect button clicks in the Frame component

Notes to reviewers

How has it been tested?
locally

@@ -0,0 +1,34 @@
import React, { createContext, useState, useContext, ReactNode } from 'react';

type TextInputsContextType = {
Copy link
Contributor

Choose a reason for hiding this comment

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

At some point we want to start organize the types in a types.ts file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I was wondering about that. And also moving the RedirectModalContext into contexts.

I'll do a little clean-up PR in the next couple days with some of those chores.

@Zizzamia Zizzamia merged commit aef870d into main Sep 6, 2024
16 checks passed
@Zizzamia Zizzamia deleted the fix/multiple-text-inputs branch September 6, 2024 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants