million icon indicating copy to clipboard operation
million copied to clipboard

bug: Found unsupported argument for block. Make sure blocks consume the reference to a component function, not the direct declaration.

Open J4v4Scr1pt opened this issue 1 year ago β€’ 10 comments

Describe the bug First off, awesome work with thisπŸ’ͺ!!

Just installed million and trying to use the block as described in the docs. But got the warning for breaking the Rules of Block. Initially I tried to removed parts of my code in the component that I thought could potentially affect this and none of it worked. I then removed my code for the component completely and replaced the whole component with code example show on the github page, but still get the same warning. I'm a bit lost on what could be wrong and how to solve the issue πŸ€”, help and a point to the right direction would be much appreciated.

Expected behavior To work as expected.

Screenshots image

Additional context package.js: "million": "^2.4.6-beta.0", "react": "^18.2.0", "webpack": "^5.73.0",

J4v4Scr1pt avatar Jun 14 '23 06:06 J4v4Scr1pt

Quick question – does this work during runtime? Is it just a warning?

aidenybai avatar Jun 14 '23 06:06 aidenybai

Yes sorry forgot to mention this, the warning accurs during build time. Runtime it does not give any warning or error and everything works.

image

J4v4Scr1pt avatar Jun 14 '23 06:06 J4v4Scr1pt

Should be fixed in v2.4.6-beta.1!

aidenybai avatar Jun 14 '23 06:06 aidenybai

Wow that was a fast deploy 😁!

Installed it: image But unfortunatly I still get the same issue 😒..

I will be away for a couple of hours now, but if there is anything I can provide I'm more than willing to help. Just write here and I will get back to you as soon as I can!

You rock 🀘!

This is how the component looks:

import { useState } from "react";
import { block } from "million/react";

const Counter = block(function Counter({ initialCount }) {
	const [count, setCount] = useState(1);
	const handleClick = () => {
		setCount(count + 1);
	};
	return <button onClick={handleClick}>{count}</button>;
});

export default Counter;

J4v4Scr1pt avatar Jun 14 '23 06:06 J4v4Scr1pt

Thank you! Sorry about that, just pushed another fix v2.4.6-beta.2. If that doesn't work, ping me again!

aidenybai avatar Jun 14 '23 07:06 aidenybai

@aidenybai Hi, got the same error, posted on discord, I didn't saw this issue. The error is still here even with v2.4.6-beta.2

ls-devs avatar Jun 14 '23 09:06 ls-devs

Thank you! Sorry about that, just pushed another fix v2.4.6-beta.2. If that doesn't work, ping me again!

No need to be sorry mate! You do an awesome work with this! πŸ˜€ This solved the issue for me, now the error is gone πŸ˜„!

Keep up the great work man! πŸš€

J4v4Scr1pt avatar Jun 14 '23 12:06 J4v4Scr1pt

@aidenybai Hi, got the same error, posted on discord, I didn't saw this issue. The error is still here even with v2.4.6-beta.2

Have you tried doing a clean install of the npm packages? Because beta.2 solved this for me.. πŸ€”

J4v4Scr1pt avatar Jun 14 '23 12:06 J4v4Scr1pt

@aidenybai Hi, got the same error, posted on discord, I didn't saw this issue. The error is still here even with v2.4.6-beta.2

Have you tried doing a clean install of the npm packages? Because beta.2 solved this for me.. thinking

Hmm, interesting. What do you mean? I'm glad your issues have been resolved by the way!

tobySolutions avatar Jun 16 '23 23:06 tobySolutions

The issue not gone for me even after clean install. Maybe there's something to do with next.js ?

ls-devs avatar Jun 19 '23 10:06 ls-devs

@ls-devs late, but can you share your usage?

aidenybai avatar Jun 22 '23 01:06 aidenybai

@ls-devs late, but can you share your usage?

Hi @aidenybai you already fixed it. I opened an issue on discord and u fixed it (pseudo discord : Despues)

ls-devs avatar Jun 23 '23 10:06 ls-devs

Hi, I got an error when using vite, any idea?

image

coy102 avatar Jun 24 '23 13:06 coy102

Hi, I got an error when using vite, any idea?

image

Hey! Can you share your code so we can reproduce this @coy102? We should probably close this issue for now. Can you open another issue so we can track it?

tobySolutions avatar Jun 24 '23 13:06 tobySolutions

Thank you @J4v4Scr1pt, @aidenybai!

tobySolutions avatar Jun 24 '23 13:06 tobySolutions

Hi, I got an error when using vite, any idea? image

Hey! Can you share your code so we can reproduce this @coy102? We should probably close this issue for now. Can you open another issue so we can track it?

sure, i'll open another issue, thanks

coy102 avatar Jun 24 '23 13:06 coy102

@coy102 please open another issue, closing this

aidenybai avatar Jun 29 '23 06:06 aidenybai