Closed davesagraf closed 8 months ago
I’ve just tried millionjs with automatic mode and I’m seeing the same behavior.
Hmm, @davesagraf, @wmitsuda; thanks for this! Let me have a review of what the issue is.
I'll have some similar issue before. let me help you on this if I can help @tobySolutions
I'll have some similar issue before. let me help you on this if I can help @tobySolutions
Awesome! Go ahead please Oliver
I’ve just tried millionjs with automatic mode and I’m seeing the same behavior.
I don't know if it has anything to do with project being run on bun in particular, but in my case this behavior has been the same with any combination of true/false set for reactStrictMode in nextConfig and auto in millionConfig here:
import million from "million/compiler";
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true
}
const millionConfig = {
auto: true,
}
export default million.next(nextConfig, millionConfig);
I had a similar issue, the only way I could fix it was by moving the form to a separate component and make it an uncontrolled component.
I had a similar issue, the only way I could fix it was by moving the form to a separate component and make it an uncontrolled component.
Hmm, can I see a demo of this?
Any updates @oliverloops?
I had a similar issue, the only way I could fix it was by moving the form to a separate component and make it an uncontrolled component.
Hmm, can I see a demo of this?
Sure thing.
Here is the quick demo of the bug with controlled component, this code is very similar to the expense tracker demo from the sink. Except, that the input element expense is now controlled by the parent component. Note: Only the first input expense has been changed to demo the bug. The amount and radio buttons are still uncontrolled. So the first input will lose focus on each keystroke.
The updated code has the addition of newExpense
state, the handleOnChange
function and their usage as props in InputForm
https://gist.github.com/vimode/151c957e3abe1edd38f27c688e5400d1
The expense tracker at https://sink.million.dev does not have this issue as the form is uncontrolled element, managed by the form input itself. https://github.com/aidenybai/million/blob/main/packages/kitchen-sink/src/examples/expense-tracker.tsx
Hmm, thanks @vimode, taking a look now. Thank you.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days.
plz, don't close it!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days.
Can we turn off automatic PR closing here, so that bot doesn't close it until the issue is actually solved?
Can we turn off automatic PR closing here, so that bot doesn't close it until the issue is actually solved?
Sure thing! I'll try to check it out.
My company is also facing this issue in automatic and manual mode when wrapping components containing an input in a block. For many of them, it does not make sense for us to have uncontrolled components; I believe this is a legitimate issue that is not solved by the uncontrolled workaround. Happy to sponsor or put a bounty on this issue, more than happy to look at solving it as well--any direction is useful as we're familiar with using Million but not the Million codebase.
Edit: I see #833 solves this.
cc @aidenybai
My company is also facing this issue in automatic and manual mode when wrapping components containing an input in a block. For many of them, it does not make sense for us to have uncontrolled components; I believe this is a legitimate issue that is not solved by the uncontrolled workaround. Happy to sponsor or put a bounty on this issue, more than happy to look at solving it as well--any direction is useful as we're familiar with using Million but not the Million codebase.
Edit: I see #833 solves this.
cc @aidenybai
Thank you very much! We will look into it and give you feedback. Thank you very much.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days.
Same issue happening for me on iOS it loses focus on every letter types and weird flashes on PC
I am trying to use this in production but need help with the same input focus issue when we search. Are there any updates to this issue? Or any workarounds? If not, then I should undo the implementation.
I am trying to use this in production but need help with the same input focus issue when we search. Are there any updates to this issue? Or any workarounds? If not, then I should undo the implementation.
You could temporarily million ignore that search component wrapper to prevent that from happening for now, 3.0 has a lot of these fixes in store already.
Any updates @oliverloops?
https://million.dev/docs/automatic (go to the "Ignoring Components" section.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days.
This issue should not be closed yet.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days.
hey everyone, has this issue been solved somehow for anyone?
@davesagraf I will try later today, I did not explicitly try this example but a similar example that existed before was still reproducible a few days ago with a text input.
@davesagraf I will try later today, I did not explicitly try this example but a similar example that existed before was still reproducible a few days ago with a text input.
Hey there @0x15f can you confirm that this is still the case. Please help provide a reproduction so I can inform the team of this. @davesagraf do you experience the same issue as well?
What version of
million
are you using?2.6.4
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
bun
What operating system are you using?
Mac
What browser are you using?
Brave (Chromium based)
Describe the Bug
Hi! I've been stoked to try Million in some of my own projects for a while now (because projects at my work use older React versions and I couldn't use Million there).
I've set up a project with bun, NextJS and Million, everything seemed fine, but now there's this weird behavior that I can't figure out how to solve.
//package.json
//next.config.mjs
//parent component:
//child component:
I've already tried different MillionJS compiler options, both CommonJS & ES module imports and exports, tried separating React useState hooks in the parent component to another function and passing them as props, tried parent component with block() function and child component without, and vice versa.
I also tried adding debugger & comparing all steps with block() function and without, but DevTools don't show a difference.
I read all the MillionJS docs, followed rules of blocks and compiler settings, read about usage of UI libraries vs DOM elements, followed this post https://dev.to/tobysolutions/how-to-use-millionjs-in-a-next-app-1eim , read MillionJS docs here on github and all the previous issues, but I can't find a solution to this problem.
I know that this component doesn't need Million much and I could continue building my project with bun & NextJS for a long time and it would be fine.
However, my initial goal was to integrate Million not only when everything is lagging, but as early as possible (I started this project yesterday), so that from early on I can see all the benefits of using it and how it's affecting components I'm building, so that I could make my components better for both React and Million from the start.
Hope this issue is not too big.
Thanks.
What's the expected result?
Regular HTML input element behavior, as in any standard React component with input element.
Link to Minimal Reproducible Example
https://app.replay.io/recording/my-app--92a45a2e-bfba-4079-b65d-beb7261cd01e
Participation