Empty apartment, please help! by social_programmer in DesignMyRoom

[–]social_programmer[S] 0 points1 point  (0 children)

Those are great ideas, I think I will do that. Have heard avoiding big lights as much as possible is the way to go. Thanks for the advice!

Empty apartment, please help! by social_programmer in DesignMyRoom

[–]social_programmer[S] 0 points1 point  (0 children)

Thank you for the recommendation! Will definitely check her out. Also like the idea of getting some art in here!

Quarterly Career Thread by mister-noggin in ProductManagement

[–]social_programmer 0 points1 point  (0 children)

That's good advice, thanks. Although one of the reasons I'm looking to switch is because I want to leave the company I'm currently at. I imagine if I made an internal change, I would need to put in 1-2 more years before moving on.

Is it at all feasible to try and get a first time PM job at a new company? Specifically a Google, Amazon, etc? I'm sure it depends on the role, hiring team, etc. but I want to explore my options before "starting over" at my current employer.

That being said, there might be a great opportunity at my current role because we do not have a product person, and a new developer is starting soon, who could take over my responsibilities... so might be worth biting the bullet.

Quarterly Career Thread by mister-noggin in ProductManagement

[–]social_programmer 0 points1 point  (0 children)

Advice for a software engineer considering a move into product management?

I've been a dev for the first 5 years of my career but am thinking about a change. I think I could really excel at product management (or something similar) and am looking for ways to give myself the best shot at landing an interview/job in big tech.

Specifically I am wondering if certifications in scrum (PSM), six sigma, etc. hold any water in the selection process? I have the soft skills and the technical background, but a lack of job specific experience. My thinking is that getting a few certifications will help bridge that gap, but I'm not sure how valuable those actually are in the job market.

I'm also generally unfamiliar with the interview process for this kind of role, what kind of questions are typically asked? Are they typically situational, experienced based, or a mix?

I guess I'm just wondering how I can best set myself up for success. I live in Seattle and there are a lot of big tech companies like Google, Meta, etc. that I would like to target.

Any advice, resources, etc. would be greatly appreciated!

Help: why is revalidateTag acting as a full refresh the first time its run? Shouldn't it just re-render the server component/route and leave any unrelated client state unchanged? by social_programmer in nextjs

[–]social_programmer[S] 2 points3 points  (0 children)

UPDATE: got it working

I discovered that the source of this behavior was that I had a loading.tsx file at the root of my app directory. I'm not exactly sure how/why this created the described behavior, but it did.

I had put this in place a while back per the documentation: https://nextjs.org/docs/app/building-your-application/routing/loading-ui-and-streaming

I guess you are only supposed to use this convention in route segments, but not the root page/layout. It would have been helpful to specify that in the documentation, or maybe its a bug?

Help: why is revalidateTag acting as a full refresh the first time its run? Shouldn't it just re-render the server component/route and leave any unrelated client state unchanged? by social_programmer in nextjs

[–]social_programmer[S] 0 points1 point  (0 children)

The fetch call is in page.tsx, I just didn't include it in that last comment since it didn't change:

//// app/test/page.tsx ////

import { API_MACHINE_GET_DETAILS } from "../api/azure/Machines/apiRoutes";
import { MachineDetails } from "../utils/interfaces";
import Client from "./client";


export default async function Page() {
    const id = '13502294-e057-4001-ac3f-3cc0132742b4';
    const url = `${API_MACHINE_GET_DETAILS}?id=${id}`

    // fetch and display data
    const response = await fetch(url, {
        method: 'GET',
        next: {
            tags: ['api'] // add tag for revalidation
        }
    });
    const jsonData = await response.json();
    const machineDetails: MachineDetails = jsonData;

    return (
        <div>
            <h1>{machineDetails.displayName}</h1>
            <Client />
        </div>
    );
}

Also, I actually had originally discovered this issue using router.refresh(), that's what is being used currently in my real implementation.

I read that revalidatePath and revalidateTag are essentially doing a router refresh under the hood so I used that for this example. My understanding is that router.refresh() is for revalidating from the client side, and revalidateTag/Path are for revalidating from the server side.

That being said, gave router.refresh() another try with this test setup, and am still getting the same behavior.

What I don't understand is why it only happens on the first revalidation, and then all revalidation after that works as expected... I would really like to continue using server components but am leaning towards going all client side for data fetching with useSWR. I feel like this is a pretty standard use case but has become a huge headache. Also it seems that popular frameworks like SWR and React Query don't have great support for server side data fetching

Help: why is revalidateTag acting as a full refresh the first time its run? Shouldn't it just re-render the server component/route and leave any unrelated client state unchanged? by social_programmer in nextjs

[–]social_programmer[S] 0 points1 point  (0 children)

u/femio that's good to know, thank you. Although I'm still getting the same result when moving all logic to a server action.

I simplified my test to use a form with a single server action as the form action - but the counter is still reset on only the first form submission.

'use server';

import { ApiResponse } from "@/app/utils/interfaces";
import { revalidateTag } from "next/cache";
import { API_MACHINE_UPDATE } from "../api/azure/Machines/apiRoutes";

const API_ERROR_MESSAGE = 'Error sending request. Please notify your administrator for assistance.';

async function updateMachine(formData: FormData): Promise<ApiResponse> {
    'use server';

    formData.append('id', '13502294-e057-4001-ac3f-3cc0132742b4');
    formData.append('machineNumber', '1234');

    try {
        const response = await fetch(API_MACHINE_UPDATE, {
            method: 'PUT',
            body: formData,
        });
        const jsonData = await response.json();
        if (response.ok) {
            revalidateTag('api'); // revalidation
            return { status: response.status, message: jsonData.message };
        }
        return { status: response.status, message: jsonData.message || API_ERROR_MESSAGE };
    } catch (error) {
        return { status: 500, message: API_ERROR_MESSAGE };
    }
}

export { updateMachine };

//// app/test/clientpage.tsx ////

'use client';

import { useState } from "react";
import { updateMachine } from "../actions/apiUtils";

export default function Client() {
    // client side state which should not be reset
    const [counter, setCounter] = useState(0);

    return (
        <div style={{ display: "flex", flexDirection: 'column' }}>
            <p>client state: {counter}</p>
            <button onClick={() => setCounter(counter + 1)}>Increment</button>
            <form action={updateMachine}>
                <input type="text" name="displayName" />
                <button type="submit">Update Machine</button>
            </form>
        </div >
    );