Suppose a function $f(x,y)=x+y$ and We have to find $partial f/partial x$ given $x+y=1$. There two ways I can do this but I’m confused about which one is right and why?

$$f(x,y)=x+y=1$$

$$Rightarrow frac{partial f}{partial x}=0$$

$$frac{partial f}{partial x}=frac{partial }{partial x}(x+y)=1$$

which one is correct?